File indexing completed on 2025-01-19 03:55:11

0001 /*****************************************************************************/
0002 // Copyright 2007-2019 Adobe Systems Incorporated
0003 // All Rights Reserved.
0004 //
0005 // NOTICE:  Adobe permits you to use, modify, and distribute this file in
0006 // accordance with the terms of the Adobe license agreement accompanying it.
0007 /*****************************************************************************/
0008 
0009 #ifndef __dng_preview__
0010 #define __dng_preview__
0011 
0012 /*****************************************************************************/
0013 
0014 #include "dng_auto_ptr.h"
0015 #include "dng_classes.h"
0016 #include "dng_ifd.h"
0017 #include "dng_opcode_list.h"
0018 #include "dng_point.h"
0019 #include "dng_sdk_limits.h"
0020 #include "dng_uncopyable.h"
0021 
0022 /*****************************************************************************/
0023 
0024 class dng_preview: private dng_uncopyable
0025     {
0026 
0027     public:
0028 
0029         dng_preview_info fInfo;
0030 
0031     protected:
0032 
0033         dng_preview ();
0034 
0035     public:
0036 
0037         virtual ~dng_preview ();
0038 
0039         virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const = 0;
0040 
0041         virtual void WriteData (dng_host &host,
0042                                 dng_image_writer &writer,
0043                                 dng_basic_tag_set &basic,
0044                                 dng_stream &stream) const = 0;
0045 
0046     };
0047 
0048 /*****************************************************************************/
0049 
0050 class dng_image_preview: public dng_preview
0051     {
0052 
0053     public:
0054 
0055         AutoPtr<dng_image> fImage;
0056 
0057     private:
0058 
0059         mutable dng_ifd fIFD;
0060 
0061     public:
0062 
0063         dng_image_preview ();
0064 
0065         virtual ~dng_image_preview ();
0066 
0067         virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const;
0068 
0069         virtual void WriteData (dng_host &host,
0070                                 dng_image_writer &writer,
0071                                 dng_basic_tag_set &basic,
0072                                 dng_stream &stream) const;
0073 
0074     };
0075 
0076 /*****************************************************************************/
0077 
0078 class dng_jpeg_preview: public dng_preview
0079     {
0080 
0081     public:
0082 
0083         dng_point fPreviewSize;
0084 
0085         uint16 fPhotometricInterpretation;
0086 
0087         dng_point fYCbCrSubSampling;
0088 
0089         uint16 fYCbCrPositioning;
0090 
0091         AutoPtr<dng_memory_block> fCompressedData;
0092 
0093     public:
0094 
0095         dng_jpeg_preview ();
0096 
0097         virtual ~dng_jpeg_preview ();
0098 
0099         virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const;
0100 
0101         virtual void WriteData (dng_host &host,
0102                                 dng_image_writer &writer,
0103                                 dng_basic_tag_set &basic,
0104                                 dng_stream &stream) const;
0105 
0106         void SpoolAdobeThumbnail (dng_stream &stream) const;
0107 
0108     };
0109 
0110 /*****************************************************************************/
0111 
0112 class dng_raw_preview: public dng_preview
0113     {
0114 
0115     public:
0116 
0117         AutoPtr<dng_image> fImage;
0118 
0119         AutoPtr<dng_memory_block> fOpcodeList2Data;
0120 
0121         real64 fBlackLevel [kMaxSamplesPerPixel];
0122 
0123         int32 fCompressionQuality;
0124 
0125     private:
0126 
0127         mutable dng_ifd fIFD;
0128 
0129     public:
0130 
0131         dng_raw_preview ();
0132 
0133         virtual ~dng_raw_preview ();
0134 
0135         virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const;
0136 
0137         virtual void WriteData (dng_host &host,
0138                                 dng_image_writer &writer,
0139                                 dng_basic_tag_set &basic,
0140                                 dng_stream &stream) const;
0141 
0142     };
0143 
0144 /*****************************************************************************/
0145 
0146 class dng_depth_preview: public dng_preview
0147     {
0148 
0149     public:
0150 
0151         AutoPtr<dng_image> fImage;
0152 
0153         int32 fCompressionQuality;
0154 
0155         bool fFullResolution;
0156 
0157     private:
0158 
0159         mutable dng_ifd fIFD;
0160 
0161     public:
0162 
0163         dng_depth_preview ();
0164 
0165         virtual ~dng_depth_preview ();
0166 
0167         virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const;
0168 
0169         virtual void WriteData (dng_host &host,
0170                                 dng_image_writer &writer,
0171                                 dng_basic_tag_set &basic,
0172                                 dng_stream &stream) const;
0173 
0174     };
0175 
0176 /*****************************************************************************/
0177 
0178 class dng_mask_preview: public dng_preview
0179     {
0180 
0181     public:
0182 
0183         AutoPtr<dng_image> fImage;
0184 
0185         int32 fCompressionQuality;
0186 
0187     private:
0188 
0189         mutable dng_ifd fIFD;
0190 
0191     public:
0192 
0193         dng_mask_preview ();
0194 
0195         virtual ~dng_mask_preview ();
0196 
0197         virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const;
0198 
0199         virtual void WriteData (dng_host &host,
0200                                 dng_image_writer &writer,
0201                                 dng_basic_tag_set &basic,
0202                                 dng_stream &stream) const;
0203 
0204     };
0205 
0206 /*****************************************************************************/
0207 
0208 class dng_preview_list
0209     {
0210 
0211     private:
0212 
0213         uint32 fCount;
0214 
0215         AutoPtr<dng_preview> fPreview [kMaxDNGPreviews];
0216 
0217     public:
0218 
0219         dng_preview_list ();
0220 
0221         ~dng_preview_list ();
0222 
0223         uint32 Count () const
0224             {
0225             return fCount;
0226             }
0227 
0228         const dng_preview & Preview (uint32 index) const
0229             {
0230             return *(fPreview [index]);
0231             }
0232 
0233         void Append (AutoPtr<dng_preview> &preview);
0234 
0235     };
0236 
0237 /*****************************************************************************/
0238 
0239 #endif
0240 
0241 /*****************************************************************************/