NLMISC::CBGRA Class Reference

#include <rgba.h>


Detailed Description

Class pixel BGRA, Windows style pixel.
Author:
Cyril Corvazier

Nevrax France

Date:
2000

Definition at line 361 of file rgba.h.

Public Member Functions

void blendFromui (CBGRA &c0, CBGRA &c1, uint factor)
 CBGRA (uint8 r, uint8 g, uint8 b, uint8 a=255)
 CBGRA (CRGBA c)
 CBGRA ()
 Default constructor. do nothing.

uint getPacked () const
 operator CRGBA ()
bool operator< (const CBGRA &c) const
bool operator== (const CBGRA &c) const
void serial (class NLMISC::IStream &f)
void set (uint8 r, uint8 g, uint8 b, uint8 a)

Data Fields

uint8 A
 Alpha componant.

uint8 B
 Blue componant.

uint8 G
 Green componant.

uint8 R
 Red componant.


Constructor & Destructor Documentation

NLMISC::CBGRA::CBGRA  )  [inline]
 

Default constructor. do nothing.

Definition at line 366 of file rgba.h.

00366 {};

NLMISC::CBGRA::CBGRA CRGBA  c  )  [inline]
 

Constructor from a CRGBA

Parameters:
c CRGBA color.

Definition at line 372 of file rgba.h.

References NLMISC::CRGBA::A, NLMISC::CRGBA::B, NLMISC::CRGBA::G, and NLMISC::CRGBA::R.

00373         {
00374                 R=c.R;
00375                 G=c.G;
00376                 B=c.B;
00377                 A=c.A;
00378         };

NLMISC::CBGRA::CBGRA uint8  r,
uint8  g,
uint8  b,
uint8  a = 255
[inline]
 

Constructor.

Parameters:
r Red componant.
g Green componant.
b Blue componant.
a Alpha componant.

Definition at line 387 of file rgba.h.

References r, and uint8.

00387                                                       :
00388                 R(r), G(g), B(b), A(a) {}


Member Function Documentation

void NLMISC::CBGRA::blendFromui CBGRA c0,
CBGRA c1,
uint  factor
 

Blend two colors.

Parameters:
c0 Color 0.
c1 Color 1.
factor Blend factor. 0~256. 0 return c0 and 256 return c1.

Definition at line 597 of file rgba.cpp.

References A, B, G, R, and uint.

00598 {
00599         int     a1 = coef;
00600         int     a2 = 256-a1;
00601         R = (c0.R*a2 + c1.R*a1) >>8;
00602         G = (c0.G*a2 + c1.G*a1) >>8;
00603         B = (c0.B*a2 + c1.B*a1) >>8;
00604         A = (c0.A*a2 + c1.A*a1) >>8;
00605 }

uint NLMISC::CBGRA::getPacked  )  const [inline]
 

Return a packed pixel

Definition at line 401 of file rgba.h.

References uint.

Referenced by operator<().

00402         {
00403                 return ((uint)R<<24) + ((uint)G<<16) + ((uint)B<<8) + A;
00404         }

NLMISC::CBGRA::operator CRGBA  )  [inline]
 

Cast operator to CRGBA.

Definition at line 393 of file rgba.h.

00394         {
00395                 return CRGBA (R, G, B, A);
00396         }

bool NLMISC::CBGRA::operator< const CBGRA c  )  const [inline]
 

Comparison operator.

Definition at line 409 of file rgba.h.

References getPacked().

00410         {
00411                 return getPacked()<c.getPacked();
00412         }

bool NLMISC::CBGRA::operator== const CBGRA c  )  const [inline]
 

Equality operator.

Definition at line 417 of file rgba.h.

References A, B, G, and R.

00418         {
00419                 return R==c.R && G==c.G && B==c.B && A==c.A;
00420         }

void NLMISC::CBGRA::serial class NLMISC::IStream f  ) 
 

Serialisation.

Parameters:
f Stream used for serialisation.

Definition at line 581 of file rgba.cpp.

00582 {
00583         f.serial (B);
00584         f.serial (G);
00585         f.serial (R);
00586         f.serial (A);
00587 }

void NLMISC::CBGRA::set uint8  r,
uint8  g,
uint8  b,
uint8  a
 

Set colors.

Parameters:
r Red componant.
g Green componant.
b Blue componant.
a Alpha componant.

Definition at line 589 of file rgba.cpp.

References r, and uint8.

00590 {
00591         R = r;
00592         G = g;
00593         B = b;
00594         A = a;
00595 }


Field Documentation

uint8 NLMISC::CBGRA::A
 

Alpha componant.

Definition at line 452 of file rgba.h.

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

uint8 NLMISC::CBGRA::B
 

Blue componant.

Definition at line 450 of file rgba.h.

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

uint8 NLMISC::CBGRA::G
 

Green componant.

Definition at line 448 of file rgba.h.

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

uint8 NLMISC::CBGRA::R
 

Red componant.

Definition at line 446 of file rgba.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 13:02:04 2004 for NeL by doxygen 1.3.6