Canola  0.8.D001
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
icon_pixel Class Reference

#include <icon_pixel.h>

List of all members.

Public Types

typedef double real_type
typedef unsigned short short_type
typedef unsigned char byte_type

Public Member Functions

 ~icon_pixel ()
 icon_pixel ()
 icon_pixel (short_type rr, short_type gg, short_type bb)
 icon_pixel (short_type rr, short_type gg, short_type bb, short_type aa)
 icon_pixel (real_type rr, real_type gg, real_type bb)
 icon_pixel (real_type rr, real_type gg, real_type bb, real_type aa)
 icon_pixel (const icon_pixel &arg)
icon_pixeloperator= (const icon_pixel &arg)
bool is_transparent (void) const
bool is_opaque (void) const
icon_pixel invert (void) const
real_type get_red (void) const
real_type get_green (void) const
real_type get_blue (void) const
real_type get_alpha (void) const
short_type get_red_short (void) const
byte_type get_red_byte (void) const
short_type get_green_short (void) const
byte_type get_green_byte (void) const
short_type get_blue_short (void) const
byte_type get_blue_byte (void) const
short_type get_alpha_short (void) const
byte_type get_alpha_byte (void) const
std::string representation (void) const
bool operator== (const icon_pixel &rhs) const
bool operator!= (const icon_pixel &rhs) const
void operator*= (const icon_pixel &rhs)
icon_pixel operator* (const icon_pixel &rhs) const
void operator*= (double)
icon_pixel operator* (double) const
icon_pixel monochrome (void) const
real_type get_intensity (void) const

Static Public Member Functions

static short_type short_from_byte (byte_type x)

Static Public Attributes

static const icon_pixel black
static const icon_pixel white
static const icon_pixel transparent

Private Member Functions

void convert_real_to_short (void) const
void convert_short_to_real (void) const

Static Private Member Functions

static short_type convert_channel_real_to_short (real_type x)
static real_type convert_channel_short_to_real (short_type x)

Private Attributes

real_type red_real
short_type red_short
real_type green_real
short_type green_short
real_type blue_real
short_type blue_short
real_type alpha_real
short_type alpha_short
bool real_valid
bool short_valid

Detailed Description

The icon_pixel class is used to represent a pixel of an RGBA image.

(It isn't called plain "pixel" because of the anencephalic design [actually, a distinct *lack* of design] of libnetpbm. Name space pollution everywhere! Sheesh.)

Definition at line 32 of file icon_pixel.h.


Member Typedef Documentation

typedef unsigned char icon_pixel::byte_type

Definition at line 47 of file icon_pixel.h.

typedef double icon_pixel::real_type

Definition at line 45 of file icon_pixel.h.

typedef unsigned short icon_pixel::short_type

Definition at line 46 of file icon_pixel.h.


Constructor & Destructor Documentation

The destructor. It is not virtual, shou shalt not derive from this class.

Definition at line 39 of file icon_pixel.h.

icon_pixel::icon_pixel ( ) [inline]

The default constructor. The default pixel is completely transparent.

Definition at line 53 of file icon_pixel.h.

icon_pixel::icon_pixel ( short_type  rr,
short_type  gg,
short_type  bb 
) [inline]

The constructor.

Parameters:
rrThe red channel value, range [0, 65535].
ggThe green channel value, range [0, 65535].
bbThe blue channel value, range [0, 65535].

The default alpha channel is completely opaque.

Definition at line 79 of file icon_pixel.h.

icon_pixel::icon_pixel ( short_type  rr,
short_type  gg,
short_type  bb,
short_type  aa 
) [inline]

The constructor.

Parameters:
rrThe red channel value, range [0, 65535].
ggThe green channel value, range [0, 65535].
bbThe blue channel value, range [0, 65535].
aaThe alpha channel value, range [0, 65535].

Definition at line 105 of file icon_pixel.h.

icon_pixel::icon_pixel ( real_type  rr,
real_type  gg,
real_type  bb 
) [inline]

The constructor.

Parameters:
rrThe red channel value, range [0.0, 1.0].
ggThe green channel value, range [0.0, 1.0].
bbThe blue channel value, range [0.0, 1.0].

The default alpha channel is completely opaque.

Definition at line 131 of file icon_pixel.h.

icon_pixel::icon_pixel ( real_type  rr,
real_type  gg,
real_type  bb,
real_type  aa 
) [inline]

The constructor.

Parameters:
rrThe red channel value, range [0.0, 1.0].
ggThe green channel value, range [0.0, 1.0].
bbThe blue channel value, range [0.0, 1.0].
aaThe alpha channel value, range [0.0, 1.0].

Definition at line 157 of file icon_pixel.h.

icon_pixel::icon_pixel ( const icon_pixel arg) [inline]

The copy constructor.

Definition at line 174 of file icon_pixel.h.


Member Function Documentation

static short_type icon_pixel::convert_channel_real_to_short ( real_type  x) [inline, static, private]

The convert_channel_real_to_short class method is used to convert a double in [0.0, 1.0] to an integer in [0, 65535] The conversion is designed to divide the input range into 65536 equally-sized regions. This is achieved by multiplying by 65536 and then special-casing the result of an input value of 1.0 so that it maps to 65535 instead of 65536.

Definition at line 518 of file icon_pixel.h.

static real_type icon_pixel::convert_channel_short_to_real ( short_type  x) [inline, static, private]

The convert_channel_short_to_real class method is used to convert * an integer in [0, 65535] to a double in [0.0, 1.0]. This is achieved by dividing by 65536 and then special-casing the result of an input value of 65535 so that it maps to 1.0 instead of 0.9999847412109375.

Definition at line 549 of file icon_pixel.h.

void icon_pixel::convert_real_to_short ( void  ) const [inline, private]

The convert_real_to_short method is used to translate the realRGBA values into shortRGBA values. This is done on demand.

Definition at line 531 of file icon_pixel.h.

void icon_pixel::convert_short_to_real ( void  ) const [inline, private]

Definition at line 557 of file icon_pixel.h.

real_type icon_pixel::get_alpha ( void  ) const [inline]

Definition at line 293 of file icon_pixel.h.

byte_type icon_pixel::get_alpha_byte ( void  ) const [inline]

Definition at line 365 of file icon_pixel.h.

short_type icon_pixel::get_alpha_short ( void  ) const [inline]

Definition at line 356 of file icon_pixel.h.

real_type icon_pixel::get_blue ( void  ) const [inline]

Definition at line 284 of file icon_pixel.h.

byte_type icon_pixel::get_blue_byte ( void  ) const [inline]

Definition at line 347 of file icon_pixel.h.

short_type icon_pixel::get_blue_short ( void  ) const [inline]

Definition at line 338 of file icon_pixel.h.

real_type icon_pixel::get_green ( void  ) const [inline]

Definition at line 275 of file icon_pixel.h.

byte_type icon_pixel::get_green_byte ( void  ) const [inline]

Definition at line 329 of file icon_pixel.h.

short_type icon_pixel::get_green_short ( void  ) const [inline]

Definition at line 320 of file icon_pixel.h.

The get_intensity is used to obtain the value of the Y channel (the monochome channel).

Definition at line 136 of file icon_pixel.cc.

real_type icon_pixel::get_red ( void  ) const [inline]

Definition at line 266 of file icon_pixel.h.

byte_type icon_pixel::get_red_byte ( void  ) const [inline]

Definition at line 311 of file icon_pixel.h.

short_type icon_pixel::get_red_short ( void  ) const [inline]

Definition at line 302 of file icon_pixel.h.

icon_pixel icon_pixel::invert ( void  ) const [inline]

The invert method may be used to create a new ixcon_pixel from this one, where the color channels are inverted. The alpha channel retains the same value.

Definition at line 240 of file icon_pixel.h.

bool icon_pixel::is_opaque ( void  ) const [inline]

The is_opaque method is used to determine whether or not a pixel is opaque, without incuring any on-demand conversion penalty.

Definition at line 228 of file icon_pixel.h.

bool icon_pixel::is_transparent ( void  ) const [inline]

The is_transparent method is used to determine whether or not a pixel is transparent, without incuring any on-demand conversion penalty.

Definition at line 216 of file icon_pixel.h.

The monochrome method may be used to calculate a monochrime pixel value, based on this pixlel.

Definition at line 146 of file icon_pixel.cc.

bool icon_pixel::operator!= ( const icon_pixel rhs) const [inline]

The inequality operator is used to compare two pixel values to see if they represent the different colors.

Parameters:
rhsThe right hand side of the comparison.

Definition at line 396 of file icon_pixel.h.

icon_pixel icon_pixel::operator* ( const icon_pixel rhs) const

The multiply in situ operator.

Definition at line 83 of file icon_pixel.cc.

icon_pixel icon_pixel::operator* ( double  rhs) const

The multiply in situ operator.

Definition at line 126 of file icon_pixel.cc.

void icon_pixel::operator*= ( const icon_pixel rhs)

The multiply in situ operator.

Definition at line 63 of file icon_pixel.cc.

void icon_pixel::operator*= ( double  rhs)

The multiply in situ operator.

Definition at line 93 of file icon_pixel.cc.

icon_pixel& icon_pixel::operator= ( const icon_pixel arg) [inline]

The assignment operator.

Definition at line 192 of file icon_pixel.h.

bool icon_pixel::operator== ( const icon_pixel rhs) const

The equality operator is used to compare two pixel values to see if they represent the same color.

Parameters:
rhsThe right hand side of the comparison.

Definition at line 44 of file icon_pixel.cc.

std::string icon_pixel::representation ( void  ) const

The representation method is used to obtain a representation of this icon_pixel, usually for printing within debug messages.

Definition at line 28 of file icon_pixel.cc.

static short_type icon_pixel::short_from_byte ( byte_type  x) [inline, static]

The short_from_byte class method is used to turn a byte value into a short value.

Definition at line 439 of file icon_pixel.h.


Member Data Documentation

real_type icon_pixel::alpha_real [mutable, private]

The alpha_real instance variable is used to remember the value of the Red channel, as a floating point number in the range [0.0, 1.0].

Definition at line 489 of file icon_pixel.h.

short_type icon_pixel::alpha_short [mutable, private]

The alpha_short instance variable is used to remember the value of the Alpha channel, as an integer in the range [0, 65535].

Definition at line 495 of file icon_pixel.h.

const icon_pixel icon_pixel::black [static]

Definition at line 41 of file icon_pixel.h.

real_type icon_pixel::blue_real [mutable, private]

The blue_real instance variable is used to remember the value of the Blue channel, as a floating point number in the range [0.0, 1.0].

Definition at line 476 of file icon_pixel.h.

short_type icon_pixel::blue_short [mutable, private]

The blue_short instance variable is used to remember the value of the Blue channel, as an integer in the range [0, 65535].

Definition at line 482 of file icon_pixel.h.

real_type icon_pixel::green_real [mutable, private]

The green_real instance variable is used to remember the value of the Green channel, as a floating point number in the range [0.0, 1.0].

Definition at line 463 of file icon_pixel.h.

short_type icon_pixel::green_short [mutable, private]

The green_short instance variable is used to remember the value of the Green channel, as an integer in the range [0, 65535].

Definition at line 469 of file icon_pixel.h.

bool icon_pixel::real_valid [mutable, private]

The real_valid instance variable is used to remember whether or not the *_real instance variables are valid.

Definition at line 501 of file icon_pixel.h.

real_type icon_pixel::red_real [mutable, private]

The red_real instance variable is used to remember the value of the Red channel, as a floating point number in the range [0.0, 1.0].

Definition at line 450 of file icon_pixel.h.

short_type icon_pixel::red_short [mutable, private]

The red_short instance variable is used to remember the value of the Red channel, as an integer in the range [0, 65535].

Definition at line 456 of file icon_pixel.h.

bool icon_pixel::short_valid [mutable, private]

The short_valid instance variable is used to remember whether or not the *_short instance variables are valid.

Definition at line 507 of file icon_pixel.h.

Definition at line 43 of file icon_pixel.h.

const icon_pixel icon_pixel::white [static]

Definition at line 42 of file icon_pixel.h.


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