Ipelib
|
A bitmap. More...
#include <ipebitmap.h>
A bitmap.
Bitmaps are explicitely shared using reference-counting. Copying is cheap, so Bitmap objects are meant to be passed by value.
The bitmap can cache data to speed up rendering. This data can be set only once (as the bitmap is conceptually immutable).
The bitmap also provides a slot for short-term storage of an "object number". The PDF embedder, for instance, sets it to the PDF object number when embedding the bitmap, and can reuse it when "drawing" the bitmap.
enum ipe::Bitmap::TFilter |
Bitmap::Bitmap | ( | ) |
Default constructor constructs null bitmap.
Bitmap::Bitmap | ( | int | width, |
int | height, | ||
TColorSpace | colorSpace, | ||
int | bitsPerComponent, | ||
Buffer | data, | ||
TFilter | filter, | ||
bool | deflate = false |
||
) |
Create a new image.
Bitmap::Bitmap | ( | const XmlAttributes & | attr, |
String | data | ||
) |
Create from XML stream.
Bitmap::Bitmap | ( | const XmlAttributes & | attr, |
Buffer | data | ||
) |
Create from XML using external raw data.
Bitmap::Bitmap | ( | const Bitmap & | rhs | ) |
Copy constructor.
Since Bitmaps are reference counted, this is very fast.
Bitmap::~Bitmap | ( | ) |
Destructor.
Assignment operator (takes care of reference counting).
Very fast.
void Bitmap::saveAsXml | ( | Stream & | stream, |
int | id, | ||
int | pdfObjNum = -1 |
||
) | const |
Save bitmap in XML stream.
bool ipe::Bitmap::isNull | ( | ) | const [inline] |
Is this a null bitmap?
bool Bitmap::equal | ( | Bitmap | rhs | ) | const |
Bitmap::TColorSpace ipe::Bitmap::colorSpace | ( | ) | const [inline] |
Return the color space of the image.
Bitmap::TFilter ipe::Bitmap::filter | ( | ) | const [inline] |
Return the data filter of the image data.
int ipe::Bitmap::components | ( | ) | const [inline] |
Return number of components per pixel.
int ipe::Bitmap::bitsPerComponent | ( | ) | const [inline] |
Return the number of bits per component.
int ipe::Bitmap::width | ( | ) | const [inline] |
Return width of pixel array.
int ipe::Bitmap::height | ( | ) | const [inline] |
Return height of pixel array.
int Bitmap::colorKey | ( | ) | const |
Return rgb representation of the transparent color.
Returns -1 if the bitmap is not color keyed.
void Bitmap::setColorKey | ( | int | key | ) |
Set transparent color.
Use key == -1 to disable color key.
const char * ipe::Bitmap::data | ( | ) | const [inline] |
Return a pointer to the image data (in PDF arrangement).
int ipe::Bitmap::size | ( | ) | const [inline] |
Return size (number of bytes) of image data (in PDF arrangement).
int ipe::Bitmap::objNum | ( | ) | const [inline] |
Return object number of the bitmap.
void ipe::Bitmap::setObjNum | ( | int | objNum | ) | const [inline] |
Set object number of the bitmap.
Bitmap::MRenderData * ipe::Bitmap::renderData | ( | ) | const [inline] |
Return cached bitmap for rendering.
void Bitmap::setRenderData | ( | MRenderData * | data | ) | const |
Set a cached bitmap for fast rendering.
Buffer Bitmap::pixelData | ( | ) | const |
Convert bitmap data to a height x width pixel array in rgb format.
Returns empty buffer if it cannot decode the bitmap information. Otherwise, returns a buffer of size Width() * Height() uint's.
bool ipe::Bitmap::operator== | ( | const Bitmap & | rhs | ) | const [inline] |
Two bitmaps are equal if they share the same data.
bool ipe::Bitmap::operator!= | ( | const Bitmap & | rhs | ) | const [inline] |
Two bitmaps are equal if they share the same data.
bool ipe::Bitmap::operator< | ( | const Bitmap & | rhs | ) | const [inline] |
Less operator, to be able to sort bitmaps.
The checksum is used, when it is equal, the shared address. This guarantees that bitmaps that are == (share their implementation) are next to each other, and blocks of them are next to blocks that are identical in contents.