DocumentationOverviewBuilding ASL Documentation Library Wiki Docs Indices Browse Perforce More InfoRelease NotesWiki Site Search License Success Stories Contributors MediaDownloadPerforce Depots SupportASL SourceForge HomeMailing Lists Discussion Forums Report Bugs Suggest Features Contribute to ASL RSSShort-text newsFull-text news File releases Other Adobe ProjectsAdobe AirAdobe GIL Adobe Labs Adobe Media Gallery Adobe XMP Tamarin project (Mozilla Foundation) Other ResourcesBoostRIAForge SGI STL |
dng_image.hGo to the documentation of this file.00001 /*****************************************************************************/ 00002 // Copyright 2006-2008 Adobe Systems Incorporated 00003 // All Rights Reserved. 00004 // 00005 // NOTICE: Adobe permits you to use, modify, and distribute this file in 00006 // accordance with the terms of the Adobe license agreement accompanying it. 00007 /*****************************************************************************/ 00008 00009 /* $Id: //mondo/dng_sdk_1_2/dng_sdk/source/dng_image.h#1 $ */ 00010 /* $DateTime: 2008/03/09 14:29:54 $ */ 00011 /* $Change: 431850 $ */ 00012 /* $Author: tknoll $ */ 00013 00018 /*****************************************************************************/ 00019 00020 #ifndef __dng_image__ 00021 #define __dng_image__ 00022 00023 /*****************************************************************************/ 00024 00025 #include "dng_assertions.h" 00026 #include "dng_classes.h" 00027 #include "dng_pixel_buffer.h" 00028 #include "dng_point.h" 00029 #include "dng_rect.h" 00030 #include "dng_tag_types.h" 00031 #include "dng_types.h" 00032 00033 /*****************************************************************************/ 00034 00037 00038 class dng_tile_buffer: public dng_pixel_buffer 00039 { 00040 00041 protected: 00042 00043 const dng_image &fImage; 00044 00045 void *fRefData; 00046 00047 protected: 00048 00053 00054 dng_tile_buffer (const dng_image &image, 00055 const dng_rect &tile, 00056 bool dirty); 00057 00058 virtual ~dng_tile_buffer (); 00059 00060 public: 00061 00062 void SetRefData (void *refData) 00063 { 00064 fRefData = refData; 00065 } 00066 00067 void * GetRefData () const 00068 { 00069 return fRefData; 00070 } 00071 00072 private: 00073 00074 // Hidden copy constructor and assignment operator. 00075 00076 dng_tile_buffer (const dng_tile_buffer &buffer); 00077 00078 dng_tile_buffer & operator= (const dng_tile_buffer &buffer); 00079 00080 }; 00081 00082 /*****************************************************************************/ 00083 00086 00087 class dng_const_tile_buffer: public dng_tile_buffer 00088 { 00089 00090 public: 00091 00095 00096 dng_const_tile_buffer (const dng_image &image, 00097 const dng_rect &tile); 00098 00099 virtual ~dng_const_tile_buffer (); 00100 00101 }; 00102 00103 /*****************************************************************************/ 00104 00107 00108 class dng_dirty_tile_buffer: public dng_tile_buffer 00109 { 00110 00111 public: 00112 00116 00117 dng_dirty_tile_buffer (dng_image &image, 00118 const dng_rect &tile); 00119 00120 virtual ~dng_dirty_tile_buffer (); 00121 00122 }; 00123 00124 /*****************************************************************************/ 00125 00128 00129 class dng_image 00130 { 00131 00132 friend class dng_tile_buffer; 00133 00134 protected: 00135 00136 // Bounds for this image. 00137 00138 dng_rect fBounds; 00139 00140 // Number of image planes. 00141 00142 uint32 fPlanes; 00143 00144 // Basic pixel type (TIFF tag type code). 00145 00146 uint32 fPixelType; 00147 00148 // For integer pixel types, the maximum value. If zero, it means 00149 // the maximum value that fits in the integer size. Ignored for 00150 // non-integer pixel types. 00151 00152 uint32 fPixelRange; 00153 00154 public: 00155 00157 00158 enum edge_option 00159 { 00160 00162 00163 edge_none, 00164 00166 00167 edge_zero, 00168 00170 00171 edge_repeat, 00172 00174 00175 edge_repeat_zero_last 00176 00177 }; 00178 00179 protected: 00180 00181 dng_image (const dng_rect &bounds, 00182 uint32 planes, 00183 uint32 pixelType, 00184 uint32 pixelRange); 00185 00186 public: 00187 00188 virtual ~dng_image (); 00189 00191 00192 const dng_rect & Bounds () const 00193 { 00194 return fBounds; 00195 } 00196 00198 00199 dng_point Size () const 00200 { 00201 return Bounds ().Size (); 00202 } 00203 00205 00206 uint32 Width () const 00207 { 00208 return Bounds ().W (); 00209 } 00210 00212 00213 uint32 Height () const 00214 { 00215 return Bounds ().H (); 00216 } 00217 00219 00220 uint32 Planes () const 00221 { 00222 return fPlanes; 00223 } 00224 00228 00229 uint32 PixelType () const 00230 { 00231 return fPixelType; 00232 } 00233 00236 00237 virtual void SetPixelType (uint32 pixelType); 00238 00241 00242 uint32 PixelSize () const; 00243 00248 00249 uint32 PixelRange () const; 00250 00253 00254 virtual void SetPixelRange (uint32 pixelRange); 00255 00257 00258 virtual dng_rect RepeatingTile () const; 00259 00267 00268 void Get (dng_pixel_buffer &buffer, 00269 edge_option edgeOption = edge_none, 00270 uint32 repeatV = 1, 00271 uint32 repeatH = 1) const; 00272 00275 00276 void Put (const dng_pixel_buffer &buffer); 00277 00280 00281 virtual void Trim (const dng_rect &r); 00282 00285 00286 virtual void Rotate (const dng_orientation &orientation); 00287 00294 00295 void CopyArea (const dng_image &src, 00296 const dng_rect &area, 00297 uint32 srcPlane, 00298 uint32 dstPlane, 00299 uint32 planes); 00300 00306 00307 void CopyArea (const dng_image &src, 00308 const dng_rect &area, 00309 uint32 plane, 00310 uint32 planes) 00311 { 00312 00313 CopyArea (src, area, plane, plane, planes); 00314 00315 } 00316 00322 00323 bool EqualArea (const dng_image &rhs, 00324 const dng_rect &area, 00325 uint32 plane, 00326 uint32 planes) const; 00327 00328 // Routines to set the entire image to a constant value. 00329 00330 void SetConstant_uint8 (uint8 value) 00331 { 00332 00333 DNG_ASSERT (fPixelType == ttByte, "Mismatched pixel type"); 00334 00335 SetConstant ((uint32) value); 00336 00337 } 00338 00339 void SetConstant_uint16 (uint16 value) 00340 { 00341 00342 DNG_ASSERT (fPixelType == ttShort, "Mismatched pixel type"); 00343 00344 SetConstant ((uint32) value); 00345 00346 } 00347 00348 void SetConstant_int16 (int16 value) 00349 { 00350 00351 DNG_ASSERT (fPixelType == ttSShort, "Mismatched pixel type"); 00352 00353 SetConstant ((uint32) (uint16) value); 00354 00355 } 00356 00357 void SetConstant_uint32 (uint32 value) 00358 { 00359 00360 DNG_ASSERT (fPixelType == ttLong, "Mismatched pixel type"); 00361 00362 SetConstant (value); 00363 00364 } 00365 00366 void SetConstant_real32 (real32 value) 00367 { 00368 00369 DNG_ASSERT (fPixelType == ttFloat, "Mismatched pixel type"); 00370 00371 union 00372 { 00373 uint32 i; 00374 real32 f; 00375 } x; 00376 00377 x.f = value; 00378 00379 SetConstant (x.i); 00380 00381 } 00382 00383 virtual void GetRepeat (dng_pixel_buffer &buffer, 00384 const dng_rect &srcArea, 00385 const dng_rect &dstArea) const; 00386 00387 protected: 00388 00389 virtual void AcquireTileBuffer (dng_tile_buffer &buffer, 00390 const dng_rect &area, 00391 bool dirty) const; 00392 00393 virtual void ReleaseTileBuffer (dng_tile_buffer &buffer) const; 00394 00395 virtual void DoGet (dng_pixel_buffer &buffer) const; 00396 00397 virtual void DoPut (const dng_pixel_buffer &buffer); 00398 00399 void GetEdge (dng_pixel_buffer &buffer, 00400 edge_option edgeOption, 00401 const dng_rect &srcArea, 00402 const dng_rect &dstArea) const; 00403 00404 virtual void SetConstant (uint32 value); 00405 00406 }; 00407 00408 /*****************************************************************************/ 00409 00410 #endif 00411 00412 /*****************************************************************************/ | |||
