- Main Page
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

# IpeBitmap Class Reference
[Ipe Base]

A bitmap. More...

List of all members.

## Public Types

- enum TFilter { EDirect, EFlateDecode, EDCTDecode }
- enum TColorSpace { EDeviceRGB, EDeviceGray, EDeviceCMYK }

## Public Member Functions

- IpeBitmap ()
- IpeBitmap (int width, int height, TColorSpace colorSpace, int bitsPerComponent, IpeBuffer data, TFilter filter, bool deflate=false)
- IpeBitmap (const IpeXmlAttributes &attr, IpeString data)
- IpeBitmap (const IpeXmlAttributes &attr, IpeBuffer data)
- IpeBitmap (const IpeBitmap &rhs)
- ~IpeBitmap ()
- IpeBitmap & operator= (const IpeBitmap &rhs)
- void SaveAsXml (IpeStream &stream, int id, int pdfObjNum=-1) const
- bool IsNull () const
- bool Equal (IpeBitmap rhs) const
- TColorSpace ColorSpace () const
- TFilter Filter () const
- int Components () const
- int BitsPerComponent () const
- int Width () const
- int Height () const
- const char * Data () const
- int Size () const
- int ObjNum () const
- void SetObjNum (int objNum) const
- MRenderData * RenderData () const
- void SetRenderData (MRenderData *data) const
- IpeBuffer PixelData () const
- bool operator== (const IpeBitmap &rhs) const
- bool operator!= (const IpeBitmap &rhs) const
- bool operator< (const IpeBitmap &rhs) const

## Classes

- class MRenderData
    Abstract base class for pixmap data stored by a client. More...

## Detailed Description

A bitmap.

Bitmaps are explicitely shared using reference-counting. Copying is cheap, so IpeBitmap 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.

## Constructor & Destructor Documentation

IpeBitmap::IpeBitmap | ( |  | ) |

Default constructor constructs null bitmap.

IpeBitmap::IpeBitmap | ( | int | width,
|  | int | height,
|  | TColorSpace | colorSpace,
|  | int | bitsPerComponent,
|  | IpeBuffer | data,
|  | TFilter | filter,
|  | bool | deflate = `false` |
| ) |  |  |

Create a new image.

IpeBitmap::IpeBitmap | ( | const IpeXmlAttributes & | attr,
|  | IpeString | data |
| ) |  |  |

Create from XML stream.

IpeBitmap::IpeBitmap | ( | const IpeXmlAttributes & | attr,
|  | IpeBuffer | data |
| ) |  |  |

Create from XML using external raw data.

IpeBitmap::IpeBitmap | ( | const IpeBitmap & | rhs | ) |

Copy constructor.

IpeBitmap::~IpeBitmap | ( |  | ) |

Destructor.

## Member Function Documentation

IpeBitmap & IpeBitmap::operator= | ( | const IpeBitmap & | rhs | ) |

Assignment operator (takes care of reference counting).

void IpeBitmap::SaveAsXml | ( | IpeStream & | stream,
|  | int | id,
|  | int | pdfObjNum = `-1` |
| ) |  |  | const

Save bitmap in XML stream.

bool IpeBitmap::IsNull | ( |  | ) | const`[inline]`

Is this a null bitmap?

IpeBitmap::TColorSpace IpeBitmap::ColorSpace | ( |  | ) | const`[inline]`

Return the color space of the image.

IpeBitmap::TFilter IpeBitmap::Filter | ( |  | ) | const`[inline]`

Return the data filter of the image data.

int IpeBitmap::Components | ( |  | ) | const`[inline]`

Return number of components per pixel.

int IpeBitmap::BitsPerComponent | ( |  | ) | const`[inline]`

Return the number of bits per component.

int IpeBitmap::Width | ( |  | ) | const`[inline]`

Return width of pixel array.

int IpeBitmap::Height | ( |  | ) | const`[inline]`

Return height of pixel array.

const char * IpeBitmap::Data | ( |  | ) | const`[inline]`

Return a pointer to the image data (in PDF arrangement).

int IpeBitmap::Size | ( |  | ) | const`[inline]`

Return size (number of bytes) of image data (in PDF arrangement).

int IpeBitmap::ObjNum | ( |  | ) | const`[inline]`

Return object number of the bitmap.

void IpeBitmap::SetObjNum | ( | int | objNum | ) | const`[inline]`

Set object number of the bitmap.

IpeBitmap::MRenderData * IpeBitmap::RenderData | ( |  | ) | const`[inline]`

Return cached bitmap for rendering.

void IpeBitmap::SetRenderData | ( | MRenderData * | data | ) | const

Set a cached bitmap for fast rendering.

IpeBuffer IpeBitmap::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 IpeBitmap::operator== | ( | const IpeBitmap & | rhs | ) | const`[inline]`

Two bitmaps are equal if they share the same data.

bool IpeBitmap::operator!= | ( | const IpeBitmap & | rhs | ) | const`[inline]`

Two bitmaps are equal if they share the same data.

bool IpeBitmap::operator< | ( | const IpeBitmap & | 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.

The documentation for this class was generated from the following files:

- ipebitmap.h
- ipebitmap.cpp