Imageclass for an 8-bit, 4 channel RGBA color image. More...
#include <ColorImageRGBa8.h>
Public Member Functions | |
MultiElementImage< byte, 4 > & | asMultiElementImage () |
void | assign (int i, int j, int n, int v) |
ColorImageRGBa8 (int x=0, int y=0) | |
ColorImageRGBa8 (int x, int y, ColorImageRGBa8 *m, int xo, int yo) | |
double | getElementTypeMaximum () const |
double | getElementTypeMinimum () const |
void | readFromFile (const char *fileName) |
void | writeToFile (const char *fileName) const |
Static Public Member Functions | |
static int | numberOfChannels () |
Private Attributes | |
MultiElementImage< byte, 4 > | alt |
Imageclass for an 8-bit, 4 channel RGBA color image.
This class superseeds ColorImageRGB in two aspects: It internally uses a data structure to store all samples of a pixel, which allows for the efficient assignment of entire pixels in a single statement, and it adds an alpha channel, containing transparency information for each pixel. In fact, the alpha value stores not the 'transparency' but the 'opacity' of a pixel (which is just the inverse). That is, alpha = 0 (better: alpha = getValueRangeMinimum()) means least opacity (== full transparency), while alpha = getValueRangeMaximum() denotes maximum opacity (== totally intransparent, as it would be considered for an image without alpha channel). Alpha values are considered to be in the range of 0.0 .. 1.0 (represented as 0 .. 255 in ColorImageRGBa8). then represents a 50% opaqe pixel. For any pixel p in the image with some alpha value
, which is to be rendered above some background color b, the resulting color c is computed as
Alpha channels can be stored with some common image file formats, notably PNG and TIFF, but not with e.g. PPM/PGM or JPEG.
Definition at line 63 of file ColorImageRGBa8.h.
ColorImageRGBa8::ColorImageRGBa8 | ( | int | x = 0 , |
int | y = 0 |
||
) |
Definition at line 7 of file ColorImageRGBa8.cpp.
ColorImageRGBa8::ColorImageRGBa8 | ( | int | x, |
int | y, | ||
ColorImageRGBa8 * | m, | ||
int | xo, | ||
int | yo | ||
) |
Definition at line 11 of file ColorImageRGBa8.cpp.
Definition at line 22 of file ColorImageRGBa8.cpp.
void ColorImageRGBa8::assign | ( | int | i, |
int | j, | ||
int | n, | ||
int | v | ||
) |
Set a single value
[in] | i | Line |
[in] | j | Row |
[in] | n | Channel |
[in] | v | Value |
Definition at line 16 of file ColorImageRGBa8.cpp.
double puma2::ColorImageRGBa8::getElementTypeMaximum | ( | ) | const [inline, virtual] |
see Image::getElementTypeMaximum()
Reimplemented from puma2::TBaseImg< RGBa8 >.
Definition at line 89 of file ColorImageRGBa8.h.
double puma2::ColorImageRGBa8::getElementTypeMinimum | ( | ) | const [inline, virtual] |
see Image::getElementTypeMinimum()
Reimplemented from puma2::TBaseImg< RGBa8 >.
Definition at line 86 of file ColorImageRGBa8.h.
int ColorImageRGBa8::numberOfChannels | ( | ) | [static] |
Reimplemented from puma2::SingleElementImage< RGBa8 >.
Definition at line 26 of file ColorImageRGBa8.cpp.
void ColorImageRGBa8::readFromFile | ( | const char * | fileName | ) |
Reimplemented from puma2::TBaseImg< RGBa8 >.
Definition at line 30 of file ColorImageRGBa8.cpp.
void ColorImageRGBa8::writeToFile | ( | const char * | fileName | ) | const |
Reimplemented from puma2::TBaseImg< RGBa8 >.
Definition at line 35 of file ColorImageRGBa8.cpp.
MultiElementImage<byte,4> puma2::ColorImageRGBa8::alt [private] |
TEST - ONE DESIGN OPTION: The image pointer alt will be initialized using the sub-image constructor. Using a hard type conversion cast we will cheat and this image will not allocate memory itself. Instead, it will reuse the memory allocated for the matrix in the base class SingleElementImage.
(validity of casts could be checked by a singleton upon initialization of the program)
Definition at line 108 of file ColorImageRGBa8.h.