claw::graphic::pixel32 Union Reference

#include <pixel.hpp>

List of all members.


Detailed Description

RGBA pixel.

Definition at line 80 of file pixel.hpp.


Public Types

typedef unsigned char component_type

Public Member Functions

 pixel32 ()
 Default constructor.
 pixel32 (component_type r, component_type g, component_type b, component_type a)
 Constructor.
pixel32operator= (const pixel24 &that)
 Assignement operator.
bool operator== (const pixel32 &that) const
 Tell if two pixels are equal.
bool operator!= (const pixel32 &that) const
 Tell if two pixels are different.
component_type luminosity () const
 Get the luminosity of the pixel.

Public Attributes

unsigned int pixel
 Compressed representation.
struct {
   component_type   red
 Red component.
   component_type   green
 Green component.
   component_type   blue
 Blue component.
   component_type   alpha
 Translucy.
components

Member Typedef Documentation

Definition at line 82 of file pixel.hpp.


Constructor & Destructor Documentation

claw::graphic::pixel32::pixel32 (  )  [inline]

Default constructor.

Definition at line 106 of file pixel.hpp.

00106 {}

claw::graphic::pixel32::pixel32 ( component_type  r,
component_type  g,
component_type  b,
component_type  a 
) [inline]

Constructor.

Parameters:
r The value of the red field.
g The value of the green field.
b The value of the blue field.
a The value of the alpha field.

Definition at line 115 of file pixel.hpp.

References components.

00117       { 
00118         components.red = r;
00119         components.green = g;
00120         components.blue = b;
00121         components.alpha = a;
00122       } // pixel32()


Member Function Documentation

pixel32& claw::graphic::pixel32::operator= ( const pixel24 that  )  [inline]

Assignement operator.

Parameters:
that The other pixel.
Remarks:
The alpha component of the this is set to 255.

Definition at line 129 of file pixel.hpp.

References claw::graphic::pixel24::blue, claw::graphic::pixel24::components, components, claw::graphic::pixel24::green, and claw::graphic::pixel24::red.

00130       {
00131         components.red = that.components.red;
00132         components.green = that.components.green;
00133         components.blue = that.components.blue;
00134         components.alpha = 255;
00135 
00136         return *this;
00137       } // operator=()

bool claw::graphic::pixel32::operator== ( const pixel32 that  )  const [inline]

Tell if two pixels are equal.

Parameters:
that The other pixel.

Definition at line 143 of file pixel.hpp.

References pixel.

00144       {
00145         return pixel == that.pixel;
00146       } // operator==()

bool claw::graphic::pixel32::operator!= ( const pixel32 that  )  const [inline]

Tell if two pixels are different.

Parameters:
that The other pixel.

Definition at line 152 of file pixel.hpp.

References pixel.

00153       {
00154         return pixel != that.pixel;
00155       } // operator!=()

component_type claw::graphic::pixel32::luminosity (  )  const [inline]

Get the luminosity of the pixel.

Returns:
The luminosity between 0 (dark) and 255 (light).
The luminosity is approximated with integers: $0,715160 \simeq 183 \div 256 = 0,71484375 $ $0,212671 \simeq 54 \div 256 = 0,2109375 $ $0,072169 \simeq 18 \div 256 = 0,0703125 $

Definition at line 166 of file pixel.hpp.

References components.

00167       {
00168         return ((unsigned int)components.red * 183 
00169                 + (unsigned int)components.green * 54 
00170                 + (unsigned int)components.blue * 18
00171                 ) / 256;
00172       } // luminosity()


Member Data Documentation

Compressed representation.

Definition at line 85 of file pixel.hpp.

Referenced by operator!=(), and operator==().


The documentation for this union was generated from the following file:

Generated on Thu May 22 21:07:38 2008 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.5.5