1 /*****************************************************************************/ 2 // Copyright 2007-2011 Adobe Systems Incorporated 3 // All Rights Reserved. 4 // 5 // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 // accordance with the terms of the Adobe license agreement accompanying it. 7 /*****************************************************************************/ 8 9 /* $Id: //mondo/dng_sdk_1_4/dng_sdk/source/dng_preview.h#1 $ */ 10 /* $DateTime: 2012/05/30 13:28:51 $ */ 11 /* $Change: 832332 $ */ 12 /* $Author: tknoll $ */ 13 14 /*****************************************************************************/ 15 16 #ifndef __dng_preview__ 17 #define __dng_preview__ 18 19 /*****************************************************************************/ 20 21 #include "dng_auto_ptr.h" 22 #include "dng_classes.h" 23 #include "dng_ifd.h" 24 #include "dng_opcode_list.h" 25 #include "dng_point.h" 26 #include "dng_sdk_limits.h" 27 28 /*****************************************************************************/ 29 30 class dng_preview 31 { 32 33 public: 34 35 dng_preview_info fInfo; 36 37 protected: 38 39 dng_preview (); 40 41 public: 42 43 virtual ~dng_preview (); 44 45 virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const = 0; 46 47 virtual void WriteData (dng_host &host, 48 dng_image_writer &writer, 49 dng_basic_tag_set &basic, 50 dng_stream &stream) const = 0; 51 52 }; 53 54 /*****************************************************************************/ 55 56 class dng_image_preview: public dng_preview 57 { 58 59 public: 60 61 AutoPtr<dng_image> fImage; 62 63 private: 64 65 mutable dng_ifd fIFD; 66 67 public: 68 69 dng_image_preview (); 70 71 virtual ~dng_image_preview (); 72 73 virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const; 74 75 virtual void WriteData (dng_host &host, 76 dng_image_writer &writer, 77 dng_basic_tag_set &basic, 78 dng_stream &stream) const; 79 80 private: 81 82 // Hidden copy constructor and assignment operator. 83 84 dng_image_preview (const dng_image_preview &preview); 85 86 dng_image_preview & operator= (const dng_image_preview &preview); 87 88 }; 89 90 /*****************************************************************************/ 91 92 class dng_jpeg_preview: public dng_preview 93 { 94 95 public: 96 97 dng_point fPreviewSize; 98 99 uint16 fPhotometricInterpretation; 100 101 dng_point fYCbCrSubSampling; 102 103 uint16 fYCbCrPositioning; 104 105 AutoPtr<dng_memory_block> fCompressedData; 106 107 public: 108 109 dng_jpeg_preview (); 110 111 virtual ~dng_jpeg_preview (); 112 113 virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const; 114 115 virtual void WriteData (dng_host &host, 116 dng_image_writer &writer, 117 dng_basic_tag_set &basic, 118 dng_stream &stream) const; 119 120 void SpoolAdobeThumbnail (dng_stream &stream) const; 121 122 private: 123 124 // Hidden copy constructor and assignment operator. 125 126 dng_jpeg_preview (const dng_jpeg_preview &preview); 127 128 dng_jpeg_preview & operator= (const dng_jpeg_preview &preview); 129 130 }; 131 132 /*****************************************************************************/ 133 134 class dng_raw_preview: public dng_preview 135 { 136 137 public: 138 139 AutoPtr<dng_image> fImage; 140 141 AutoPtr<dng_memory_block> fOpcodeList2Data; 142 143 int32 fCompressionQuality; 144 145 private: 146 147 mutable dng_ifd fIFD; 148 149 public: 150 151 dng_raw_preview (); 152 153 virtual ~dng_raw_preview (); 154 155 virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const; 156 157 virtual void WriteData (dng_host &host, 158 dng_image_writer &writer, 159 dng_basic_tag_set &basic, 160 dng_stream &stream) const; 161 162 private: 163 164 // Hidden copy constructor and assignment operator. 165 166 dng_raw_preview (const dng_raw_preview &preview); 167 168 dng_raw_preview & operator= (const dng_raw_preview &preview); 169 170 }; 171 172 /*****************************************************************************/ 173 174 class dng_mask_preview: public dng_preview 175 { 176 177 public: 178 179 AutoPtr<dng_image> fImage; 180 181 int32 fCompressionQuality; 182 183 private: 184 185 mutable dng_ifd fIFD; 186 187 public: 188 189 dng_mask_preview (); 190 191 virtual ~dng_mask_preview (); 192 193 virtual dng_basic_tag_set * AddTagSet (dng_tiff_directory &directory) const; 194 195 virtual void WriteData (dng_host &host, 196 dng_image_writer &writer, 197 dng_basic_tag_set &basic, 198 dng_stream &stream) const; 199 200 private: 201 202 // Hidden copy constructor and assignment operator. 203 204 dng_mask_preview (const dng_mask_preview &preview); 205 206 dng_mask_preview & operator= (const dng_mask_preview &preview); 207 208 }; 209 210 /*****************************************************************************/ 211 212 class dng_preview_list 213 { 214 215 private: 216 217 uint32 fCount; 218 219 AutoPtr<dng_preview> fPreview [kMaxDNGPreviews]; 220 221 public: 222 223 dng_preview_list (); 224 225 ~dng_preview_list (); 226 Count()227 uint32 Count () const 228 { 229 return fCount; 230 } 231 Preview(uint32 index)232 const dng_preview & Preview (uint32 index) const 233 { 234 return *(fPreview [index]); 235 } 236 237 void Append (AutoPtr<dng_preview> &preview); 238 239 }; 240 241 /*****************************************************************************/ 242 243 #endif 244 245 /*****************************************************************************/ 246