| 1 | /*****************************************************************************/ |
| 2 | // Copyright 2006-2008 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_simple_image.h#1 $ */ |
| 10 | /* $DateTime: 2012/05/30 13:28:51 $ */ |
| 11 | /* $Change: 832332 $ */ |
| 12 | /* $Author: tknoll $ */ |
| 13 | |
| 14 | /*****************************************************************************/ |
| 15 | |
| 16 | #ifndef __dng_simple_image__ |
| 17 | #define __dng_simple_image__ |
| 18 | |
| 19 | /*****************************************************************************/ |
| 20 | |
| 21 | #include "dng_auto_ptr.h" |
| 22 | #include "dng_image.h" |
| 23 | #include "dng_pixel_buffer.h" |
| 24 | |
| 25 | /*****************************************************************************/ |
| 26 | |
| 27 | /// dng_image derived class with simple Trim and Rotate functionality. |
| 28 | |
| 29 | class dng_simple_image : public dng_image |
| 30 | { |
| 31 | |
| 32 | protected: |
| 33 | |
| 34 | dng_pixel_buffer fBuffer; |
| 35 | |
| 36 | AutoPtr<dng_memory_block> fMemory; |
| 37 | |
| 38 | dng_memory_allocator &fAllocator; |
| 39 | |
| 40 | public: |
| 41 | |
| 42 | dng_simple_image (const dng_rect &bounds, |
| 43 | uint32 planes, |
| 44 | uint32 pixelType, |
| 45 | dng_memory_allocator &allocator); |
| 46 | |
| 47 | virtual ~dng_simple_image (); |
| 48 | |
| 49 | virtual dng_image * Clone () const; |
| 50 | |
| 51 | /// Setter for pixel type. |
| 52 | |
| 53 | virtual void SetPixelType (uint32 pixelType); |
| 54 | |
| 55 | /// Trim image data outside of given bounds. Memory is not reallocated or freed. |
| 56 | |
| 57 | virtual void Trim (const dng_rect &r); |
| 58 | |
| 59 | /// Rotate image according to orientation. |
| 60 | |
| 61 | virtual void Rotate (const dng_orientation &orientation); |
| 62 | |
| 63 | /// Get the buffer for direct processing. (Unique to dng_simple_image.) |
| 64 | |
| 65 | void GetPixelBuffer (dng_pixel_buffer &buffer) |
| 66 | { |
| 67 | buffer = fBuffer; |
| 68 | } |
| 69 | |
| 70 | protected: |
| 71 | |
| 72 | virtual void AcquireTileBuffer (dng_tile_buffer &buffer, |
| 73 | const dng_rect &area, |
| 74 | bool dirty) const; |
| 75 | |
| 76 | }; |
| 77 | |
| 78 | /*****************************************************************************/ |
| 79 | |
| 80 | #endif |
| 81 | |
| 82 | /*****************************************************************************/ |
| 83 | |