NLMISC::CRGBAF Class Reference

#include <rgba.h>


Detailed Description

Class pixel float RGBA
Author:
Cyril Corvazier

Nevrax France

Date:
2000

Definition at line 462 of file rgba.h.

Public Member Functions

 CRGBAF (CRGBA c)
 CRGBAF (float _r, float _g, float _b, float _a=1.f)
 CRGBAF ()
 Default constructor. do nothing.

void normalize ()
CRGBAF operator * (float f) const
CRGBAF operator * (const CRGBAF &c) const
CRGBAFoperator *= (float f)
CRGBAFoperator *= (const CRGBAF &c)
 operator CRGBA () const
CRGBAF operator+ (const CRGBAF &c) const
CRGBAFoperator+= (const CRGBAF &c)
CRGBAF operator- (const CRGBAF &c) const
CRGBAFoperator-= (const CRGBAF &c)
CRGBAF operator/ (float f) const
CRGBAFoperator/= (float f)
void serial (class NLMISC::IStream &f)
void set (float r, float g, float b, float a)

Data Fields

float A
 Alpha componant.

float B
 Blue componant.

float G
 Green componant.

float R
 Red componant.


Constructor & Destructor Documentation

NLMISC::CRGBAF::CRGBAF  )  [inline]
 

Default constructor. do nothing.

Definition at line 466 of file rgba.h.

Referenced by operator *(), operator+(), operator-(), and operator/().

00467         {}

NLMISC::CRGBAF::CRGBAF float  _r,
float  _g,
float  _b,
float  _a = 1.f
[inline]
 

Constructor.

Parameters:
_r Red componant.
_g Green componant.
_b Blue componant.
_a Alpha componant.

Definition at line 476 of file rgba.h.

00477         {
00478                 R=_r;
00479                 G=_g;
00480                 B=_b;
00481                 A=_a;
00482         }

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

Constructor with a CRGBA.

Parameters:
c CRGBA color.

Definition at line 488 of file rgba.h.

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

00489         {
00490                 R=(float)c.R/255.f;
00491                 G=(float)c.G/255.f;
00492                 B=(float)c.B/255.f;
00493                 A=(float)c.A/255.f;
00494         }


Member Function Documentation

void NLMISC::CRGBAF::normalize  )  [inline]
 

Normalize component between [0.f,1.f]

Definition at line 511 of file rgba.h.

00512         {
00513                 R= (R>1.f) ? 1.f : (R<0.f) ? 0.f : R;
00514                 G= (G>1.f) ? 1.f : (G<0.f) ? 0.f : G;
00515                 B= (B>1.f) ? 1.f : (B<0.f) ? 0.f : B;
00516                 A= (A>1.f) ? 1.f : (A<0.f) ? 0.f : A;
00517         }

CRGBAF NLMISC::CRGBAF::operator * float  f  )  const [inline]
 

Mul float operator. Mul each component by f.

Parameters:
f Float factor.
Returns:
Return the result of the opertor

Definition at line 554 of file rgba.h.

References CRGBAF().

00555         {
00556                 return CRGBAF (R*f, G*f, B*f, A*f);
00557         }

CRGBAF NLMISC::CRGBAF::operator * const CRGBAF c  )  const [inline]
 

Mul operator. Mul components.

Parameters:
c CRGBA color.
Returns:
Return the result of the opertor

Definition at line 544 of file rgba.h.

References A, B, CRGBAF(), G, and R.

00545         {
00546                 return CRGBAF (R*c.R, G*c.G, B*c.B, A*c.A);
00547         }

CRGBAF& NLMISC::CRGBAF::operator *= float  f  )  [inline]
 

Mul float operator. Multiplate each component by f.

Parameters:
f Float factor.
Returns:
Return a reference on the caller object

Definition at line 616 of file rgba.h.

00617         {
00618                 R*=f;
00619                 G*=f;
00620                 B*=f;
00621                 A*=f;
00622                 return *this;
00623         }

CRGBAF& NLMISC::CRGBAF::operator *= const CRGBAF c  )  [inline]
 

Mul operator. Multiplate each component.

Parameters:
c CRGBA color.
Returns:
Return a reference on the caller object

Definition at line 602 of file rgba.h.

References A, B, G, and R.

00603         {
00604                 R*=c.R;
00605                 G*=c.G;
00606                 B*=c.B;
00607                 A*=c.A;
00608                 return *this;
00609         }

NLMISC::CRGBAF::operator CRGBA  )  const [inline]
 

Cast operator to CRGBA.

Definition at line 499 of file rgba.h.

References uint8.

00500         {
00501                 uint8 _r=(uint8)(R*255.f);
00502                 uint8 _g=(uint8)(G*255.f);
00503                 uint8 _b=(uint8)(B*255.f);
00504                 uint8 _a=(uint8)(A*255.f);
00505                 return CRGBA (_r, _g, _b, _a);
00506         }

CRGBAF NLMISC::CRGBAF::operator+ const CRGBAF c  )  const [inline]
 

Add operator. Sum components.

Parameters:
c CRGBA color.
Returns:
Return the result of the opertor

Definition at line 524 of file rgba.h.

References A, B, CRGBAF(), G, and R.

00525         {
00526                 return CRGBAF (R+c.R, G+c.G, B+c.B, A+c.A);
00527         }

CRGBAF& NLMISC::CRGBAF::operator+= const CRGBAF c  )  [inline]
 

Add operator. Add each component.

Parameters:
c CRGBA color.
Returns:
Return a reference on the caller object

Definition at line 574 of file rgba.h.

References A, B, G, and R.

00575         {
00576                 R+=c.R;
00577                 G+=c.G;
00578                 B+=c.B;
00579                 A+=c.A;
00580                 return *this;
00581         }

CRGBAF NLMISC::CRGBAF::operator- const CRGBAF c  )  const [inline]
 

Sub operator. Substract components.

Parameters:
c CRGBA color.
Returns:
Return the result of the opertor

Definition at line 534 of file rgba.h.

References A, B, CRGBAF(), G, and R.

00535         {
00536                 return CRGBAF (R-c.R, G-c.G, B-c.B, A-c.A);
00537         }

CRGBAF& NLMISC::CRGBAF::operator-= const CRGBAF c  )  [inline]
 

Sub operator. Substract each component.

Parameters:
c CRGBA color.
Returns:
Return a reference on the caller object

Definition at line 588 of file rgba.h.

References A, B, G, and R.

00589         {
00590                 R-=c.R;
00591                 G-=c.G;
00592                 B-=c.B;
00593                 A-=c.A;
00594                 return *this;
00595         }

CRGBAF NLMISC::CRGBAF::operator/ float  f  )  const [inline]
 

Div float operator. Div each component by f.

Parameters:
f Float factor.
Returns:
Return the result of the opertor

Definition at line 564 of file rgba.h.

References CRGBAF().

00565         {
00566                 return CRGBAF (R/f, G/f, B/f, A/f);
00567         }

CRGBAF& NLMISC::CRGBAF::operator/= float  f  )  [inline]
 

Div float operator. Divide each component by f.

Parameters:
f Float factor.
Returns:
Return a reference on the caller object

Definition at line 630 of file rgba.h.

00631         {
00632                 R/=f;
00633                 G/=f;
00634                 B/=f;
00635                 A/=f;
00636                 return *this;
00637         }

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

Serialisation.

Parameters:
f Stream used for serialisation.

Definition at line 725 of file rgba.cpp.

00726 {
00727         f.serial (R);
00728         f.serial (G);
00729         f.serial (B);
00730         f.serial (A);
00731 }

void NLMISC::CRGBAF::set float  r,
float  g,
float  b,
float  a
 

Set colors.

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

Definition at line 733 of file rgba.cpp.

References r.

00734 {
00735         R = r;
00736         G = g;
00737         B = b;
00738         A = a;
00739 }


Field Documentation

float NLMISC::CRGBAF::A
 

Alpha componant.

Definition at line 661 of file rgba.h.

Referenced by NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::CRenderTrav::changeVPLightSetupMaterial(), NL3D::CPatch::generateTileVegetable(), NLMISC::CBitmap::getColor(), NL3D::CRenderTrav::getStrongestLightIndex(), NLMISC::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), NL3D::CMeshMorpher::update(), and NL3D::CMeshMorpher::updateSkinned().

float NLMISC::CRGBAF::B
 

Blue componant.

Definition at line 659 of file rgba.h.

Referenced by NL3D::CVegetableManager::addInstance(), NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::CRenderTrav::changeVPLightSetupMaterial(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CPatch::generateTileVegetable(), NLMISC::CBitmap::getColor(), NL3D::CRenderTrav::getStrongestLightIndex(), NLMISC::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), NL3D::CMeshMorpher::update(), and NL3D::CMeshMorpher::updateSkinned().

float NLMISC::CRGBAF::G
 

Green componant.

Definition at line 657 of file rgba.h.

Referenced by NL3D::CVegetableManager::addInstance(), NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::CRenderTrav::changeVPLightSetupMaterial(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CPatch::generateTileVegetable(), NLMISC::CBitmap::getColor(), NL3D::CRenderTrav::getStrongestLightIndex(), NLMISC::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), NL3D::CMeshMorpher::update(), and NL3D::CMeshMorpher::updateSkinned().

float NLMISC::CRGBAF::R
 

Red componant.

Definition at line 655 of file rgba.h.

Referenced by NL3D::CVegetableManager::addInstance(), NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::CRenderTrav::changeVPLightSetupMaterial(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CPatch::generateTileVegetable(), NLMISC::CBitmap::getColor(), NL3D::CRenderTrav::getStrongestLightIndex(), NLMISC::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), NL3D::CMeshMorpher::update(), and NL3D::CMeshMorpher::updateSkinned().


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