#include <Image.hh>
Collaboration diagram for image::CImage:
the CImage class is designed to be a very simple wrapper of raw pixels. it has no reference counting. it has no function to load from all file formats. it just stores pixels, pixel format and dimension.
pixels are stored as a vector of bytes (unsigned char). dimension and everything like those is stored in the image::CHeader object. the format of the pixel in the byte array depends on the parameters in the header.
like image::CHeader, this class is totally PDF independent. it serves only as a container of all image data.
an CImage object has two states: empty or non-empty. an empty image contains no image data, while a non-empty image contains valid image data. the class will assert that the image data is in a consistant state. you can use the Empty() member function to tell if an image is empty.
|
type for pixel data
|
|
type to iterate the pixel data
|
|
default constructor constructs an empty image.
00036 { 00037 assert( Empty( ) ) ; 00038 } |
|
constructor to initialize everything.
00043 { 00044 assert( !header.Empty( ) ) ; 00045 assert( !pixels.empty( ) ) ; 00046 00047 Assign( header, pixels ) ; 00048 assert( !Empty( ) ) ; 00049 } |
|
the destructor will clean up the pixels.
00054 { 00055 assert( IsValid( ) ) ; 00056 } |
|
this function is provided to allow fast assignment to the image's pixels. no deep copy is done here, just swap. this function cannot be used to make the image empty, use Clear() instead.
00068 { 00069 assert( !header.Empty( ) ) ; 00070 assert( !pixels.empty( ) ) ; 00071 00072 // clear our own before swapping, such that "m_pixels" will be empty 00073 Clear( ) ; 00074 00075 // swap and assign 00076 m_header = header ; 00077 m_pixels.swap( pixels ) ; 00078 00079 assert( !Empty( ) ) ; 00080 } |
|
like SwapAssign(), this function is provided for fast assignment too. it does the opposite of SwapAssign().
|
|
this function will re-initialize the object after it is constructed.
|
|
to make the image empty. you must not use Assign() or SwapAssign() to make the image empty.
00103 { 00104 assert( IsValid( ) ) ; 00105 m_pixels.clear( ) ; 00106 assert( Empty( ) ) ; 00107 } |
|
image header
|
|
pixel array
|