Bitmap< T > Class Template Reference
Template class representing a bitmap. More...
#include <labelingmath.h>
Public Member Functions | |
| Bitmap () | |
| Creates an empty bitmap with dimension 0x0. | |
| Bitmap (int width, int height, int channels=1) | |
| Creates an empty bitmap with dimensions width x height and the specified number of channels. | |
| Bitmap (T *data, int width, int height, int channels=1) | |
| Creates a bitmap by providing the data as an array and specifying its dimensions and channels count. | |
| void | setData (T *data, int width, int height, int channels=1) |
| Sets the bitmap's data by providing the data array and its dimensions and channels count. | |
| T * | getData () |
| Returns a pointer to the data. | |
| void | setElem (int x, int y, T elem, int channel=0) |
| Sets the element at pixel coordinates x and y and the specified channel. | |
| void | setElem (int index, T elem) |
| Sets the element at array position index. | |
| T | getElem (int x, int y, int channel=0) |
| Returns the element at pixel coordinates x and y and the specified channel. | |
| T | getElem (int index) |
| Returns the element at array position index. | |
| tgt::Vector2< T > | getPixel2Ch (int x, int y) |
| Returns a 2D-Vector consisting of the first 2 channels of pixel (x,y). | |
| tgt::Vector3< T > | getPixel3Ch (int x, int y) |
| Returns a 3D-Vector consisting of the first 3 channels of pixel (x,y). | |
| tgt::Vector4< T > | getPixel4Ch (int x, int y) |
| Returns a 4D-Vector consisting of the first 4 channels of pixel (x,y). | |
| void | mergeBitmap (const Bitmap< T > &src, int x_offset=0, int y_offset=0) |
| Merges this bitmap with src: This bitmap's pixels are set to src's pixels. | |
| void | blendMax (const Bitmap< T > &src, int x_offset=0, int y_offset=0) |
| Performs a maximum blending of this bitmap and src bitmap: The last channel of the bitmaps is considered the alpha channel. | |
| void | blend (const Bitmap< T > &src, int x_offset=0, int y_offset=0) |
| Performs an alpha blending of this bitmap and the source bitmap. | |
| void | freeData () |
| Deletes the bitmap's data array. | |
| int | getWidth () |
| Returns the bitmap's width. | |
| int | getHeight () |
| Returns the bitmap's height. | |
| void | setDim (int width, int height, int channels=1) |
| Sets image's dimension to width, height image data is cleared! | |
Protected Attributes | |
| T * | data_ |
| int | width_ |
| int | height_ |
| int | channels_ |
Detailed Description
template<class T>
class labeling::Bitmap< T >
Template class representing a bitmap.
Saves bitmap data and provides functions for accessing and manipulating it on a per-pixel/per-subpixel basis. Note: For performance reasons none of the functions do parameter checking. Obeying the specifications is up to the function's callers!
Definition at line 382 of file labelingmath.h.
Constructor & Destructor Documentation
| Bitmap | ( | int | width, | |
| int | height, | |||
| int | channels = 1 | |||
| ) | [inline] |
Creates an empty bitmap with dimensions width x height and the specified number of channels.
The necessary memory is allocated.
Definition at line 396 of file labelingmath.h.
| Bitmap | ( | T * | data, | |
| int | width, | |||
| int | height, | |||
| int | channels = 1 | |||
| ) | [inline] |
Creates a bitmap by providing the data as an array and specifying its dimensions and channels count.
Definition at line 405 of file labelingmath.h.
Member Function Documentation
| void blend | ( | const Bitmap< T > & | src, | |
| int | x_offset = 0, |
|||
| int | y_offset = 0 | |||
| ) | [inline] |
Performs an alpha blending of this bitmap and the source bitmap.
The last channel is considered the alpha channel. source_alpha = source alpha dest_alpha = (1-source_alpha)*dest_alpha If src's dimensions are smaller than this bitmap's dimensions, you can specifie an offset by which src bitmap is shifted.
Definition at line 531 of file labelingmath.h.
| void blendMax | ( | const Bitmap< T > & | src, | |
| int | x_offset = 0, |
|||
| int | y_offset = 0 | |||
| ) | [inline] |
Performs a maximum blending of this bitmap and src bitmap: The last channel of the bitmaps is considered the alpha channel.
For each pixel either the source or destination pixel is chosen, depending on whose alpha value is greater. If src's dimensions are smaller than this bitmap's dimensions, you can specifie an offset by which src bitmap is shifted.
Definition at line 508 of file labelingmath.h.
| T getElem | ( | int | index | ) | [inline] |
Returns the element at array position index.
Use not recommended!
Definition at line 455 of file labelingmath.h.
| T getElem | ( | int | x, | |
| int | y, | |||
| int | channel = 0 | |||
| ) | [inline] |
Returns the element at pixel coordinates x and y and the specified channel.
Definition at line 449 of file labelingmath.h.
| tgt::Vector2<T> getPixel2Ch | ( | int | x, | |
| int | y | |||
| ) | [inline] |
Returns a 2D-Vector consisting of the first 2 channels of pixel (x,y).
Definition at line 461 of file labelingmath.h.
| tgt::Vector3<T> getPixel3Ch | ( | int | x, | |
| int | y | |||
| ) | [inline] |
Returns a 3D-Vector consisting of the first 3 channels of pixel (x,y).
Reimplemented in FirstHitBitmap.
Definition at line 468 of file labelingmath.h.
| tgt::Vector4<T> getPixel4Ch | ( | int | x, | |
| int | y | |||
| ) | [inline] |
Returns a 4D-Vector consisting of the first 4 channels of pixel (x,y).
Definition at line 478 of file labelingmath.h.
| void mergeBitmap | ( | const Bitmap< T > & | src, | |
| int | x_offset = 0, |
|||
| int | y_offset = 0 | |||
| ) | [inline] |
Merges this bitmap with src: This bitmap's pixels are set to src's pixels.
If src's dimensions are smaller than this bitmap's dimensions, you can specifie an offset by which src bitmap is shifted.
Definition at line 489 of file labelingmath.h.
| void setData | ( | T * | data, | |
| int | width, | |||
| int | height, | |||
| int | channels = 1 | |||
| ) | [inline] |
Sets the bitmap's data by providing the data array and its dimensions and channels count.
Definition at line 419 of file labelingmath.h.
| void setElem | ( | int | index, | |
| T | elem | |||
| ) | [inline] |
Sets the element at array position index.
Use not recommended!
Definition at line 443 of file labelingmath.h.
| void setElem | ( | int | x, | |
| int | y, | |||
| T | elem, | |||
| int | channel = 0 | |||
| ) | [inline] |
Sets the element at pixel coordinates x and y and the specified channel.
Definition at line 437 of file labelingmath.h.