52 this->nRed = pColor->
GetRed();
54 this->nBlue = pColor->
GetBlue();
65 this->nRed = oColor.nRed;
66 this->nGreen = oColor.nGreen;
67 this->nBlue = oColor.nBlue;
68 this->nAlpha = oColor.nAlpha;
78 cColor(tInt nRedLocal, tInt nGreenLocal, tInt nBlueLocal, tInt nAlphaLocal =255)
80 this->nRed = (tUInt8) nRedLocal;
81 this->nGreen = (tUInt8) nGreenLocal;
82 this->nBlue = (tUInt8) nBlueLocal;
83 this->nAlpha = (tUInt8) nAlphaLocal;
93 cColor(tUInt8 nRed, tUInt8 nGreen, tUInt8 nBlue, tUInt8 nAlpha = 255)
95 this->nRed = (tUInt8) nRed;
96 this->nGreen = (tUInt8) nGreen;
97 this->nBlue = (tUInt8) nBlue;
98 this->nAlpha = (tUInt8) nAlpha;
108 cColor(tFloat32 fRed, tFloat32 fGreen, tFloat32 fBlue, tFloat32 fAlpha = 1.0f)
110 this->nRed = (tUInt8) (fRed * 255.0f);
111 this->nGreen = (tUInt8) (fGreen * 255.0f);
112 this->nBlue = (tUInt8) (fBlue * 255.0f);
113 this->nAlpha = (tUInt8) (fAlpha * 255.0f);
155 tVoid
Set(tInt nRedLocal, tInt nGreenLocal, tInt nBlueLocal, tInt nAlphaLocal = 255)
157 this->nRed = (tUInt8) nRedLocal;
158 this->nGreen = (tUInt8) nGreenLocal;
159 this->nBlue = (tUInt8) nBlueLocal;
160 this->nAlpha = (tUInt8) nAlphaLocal;
175 tVoid
Set(tUInt8 nRedLocal, tUInt8 nGreenLocal, tUInt8 nBlueLocal, tUInt8 nAlphaLocal = 255)
177 this->nRed = nRedLocal;
178 this->nGreen = nGreenLocal;
179 this->nBlue = nBlueLocal;
180 this->nAlpha = nAlphaLocal;
193 tVoid
Set(tFloat32 fRed, tFloat32 fGreen, tFloat32 fBlue, tFloat32 fAlpha = 1.0f)
195 this->nRed = (tUInt8) (fRed * 255.0f);
196 this->nGreen = (tUInt8) (fGreen * 255.0f);
197 this->nBlue = (tUInt8) (fBlue * 255.0f);
198 this->nAlpha = (tUInt8) (fAlpha * 255.0f);
221 tVoid
SetRGBA(tUInt32 nRGBA, tInt oPixelFormat);
266 this->nRed = nRedValue;
290 this->nGreen = nGreenValue;
314 this->nBlue = nBlueValue;
338 this->nAlpha = nAlphaValue;
362 return (tUInt8) ((116 * nRed + 602 * nGreen + 306 * nBlue) >> 10);
375 return cColor(c.nRed * nAlpha / 255,
376 c.nGreen * nAlpha / 255,
377 c.nBlue * nAlpha / 255);
389 return cColor(c.nRed * fAlpha, c.nGreen * fAlpha, c.nBlue * fAlpha);
402 tUInt8 nInvAlpha = (tUInt8) (255 - nAlpha);
404 return cColor((c1.nRed * nAlpha + c2.nRed * nInvAlpha) / 255,
405 (c1.nGreen * nAlpha + c2.nGreen * nInvAlpha) / 255,
406 (c1.nBlue * nAlpha + c2.nBlue * nInvAlpha) / 255);
419 tUInt8 nAlpha = (tUInt8) (fAlpha * 255.0f);
420 tUInt8 nInvAlpha = (tUInt8) (255 - nAlpha);
422 return cColor((c1.nRed * nAlpha + c2.nRed * nInvAlpha) / 255,
423 (c1.nGreen * nAlpha + c2.nGreen * nInvAlpha) / 255,
424 (c1.nBlue * nAlpha + c2.nBlue * nInvAlpha) / 255);
447 return static_cast<IColor*
>(
this);
457 return static_cast<const IColor*
>(
this);
Interface for color representation.
virtual tUInt8 GetRed() const =0
Returns the value for the red channel.
virtual tUInt8 GetAlpha() const =0
This function returns the value for the alpha channel.
virtual tUInt8 GetBlue() const =0
Returns the value for the blue channel.
virtual tUInt8 GetGreen() const =0
Returns the value for the green channel.
@ PF_RGBA_8888
32 bit RGBA (R: 8 bit, G: 8 bit, B: 8 bit, A: 8 bit) with alpha value - default format for 32 bpp
@ PF_BGRA_8888
32 bit BGRA (B: 8 bit, G: 8 bit, R: 8 bit, A: 8 bit) with alpha value - inverted RGB + A
static cColor Blend(const cColor &c1, const cColor &c2, tFloat32 fAlpha)
blends two colors with an alpha channel
tVoid SetAlpha(tUInt8 nAlphaValue)
Sets the value of the alpha channel.
tVoid SetBlue(tUInt8 nBlueValue)
Sets the value of the blue channel.
static const cColor Yellow
definition of color yellow
tVoid SetRGBA(tUInt32 nRGBA, tInt oPixelFormat)
Method which decodes the rgba-values stored in nRGBA depending on the given pixelformat.
static const cColor Red
definition of color red
tVoid Release()
Releases this color.
cColor(tFloat32 fRed, tFloat32 fGreen, tFloat32 fBlue, tFloat32 fAlpha=1.0f)
constructor with several init parameters.
tUInt8 GetBlue() const
Returns the value for the green channel.
tUInt8 GetRed() const
Returns the value for the red channel.
tUInt8 GetBrightness() const
This function returns the brightness value.
cColor(const IColor *pColor)
constructor from IColor
static const cColor Purple
definition of color purple
static const cColor White
definition of color white
tVoid SetGreen(tUInt8 nGreenValue)
Sets the value of the green channel.
tUInt8 GetAlpha() const
This function returns the value for the alpha channel.
tVoid Set(tInt nRedLocal, tInt nGreenLocal, tInt nBlueLocal, tInt nAlphaLocal=255)
Method to set color and transparency information.
static cColor Scale(const cColor &c, tFloat32 fAlpha)
scales a color with an alpha channel
tVoid SetRGBA(tUInt32 nRGBA)
method to set color and transparency with a combined parameter (3 color channels and the alphachannel...
cColor(const tColor &oColor)
Constructor.
tUInt32 GetRGBA(tInt oPixelFormat) const
Gets a four byte balue containing the current rgba-values encoded in the given pixel format.
tVoid SetRed(tUInt8 nRedValue)
Sets the value of the red channel.
tVoid Set(tFloat32 fRed, tFloat32 fGreen, tFloat32 fBlue, tFloat32 fAlpha=1.0f)
Method to set color and transparency information.
static cColor Scale(const cColor &c, tInt nAlpha)
scales a color with an alpha channel
cColor(tUInt8 nRed, tUInt8 nGreen, tUInt8 nBlue, tUInt8 nAlpha=255)
constructor with several init parameters.
static cColor Blend(const cColor &c1, const cColor &c2, tInt nAlpha)
blends two colors with an alpha channel
static const cColor Black
definition of color black
static const cColor Blue
definition of color blue
cColor(tUInt32 nRGBA)
Constructor with a bitfield containing the encoded rgba-values.
static const cColor Cyan
definition of color cyan
tVoid Set(tUInt8 nRedLocal, tUInt8 nGreenLocal, tUInt8 nBlueLocal, tUInt8 nAlphaLocal=255)
Method to set color and transparency information.
tUInt32 GetRGBA() const
Gets a four Byte value containing the 3 color channels and the alphachannel.
cColor()
default constructor
cColor(tUInt32 nRGBA, tInt oPixelFormat)
Constructor with a bitfield containing the encoded rgba-values and another parameter which describes ...
cColor(tInt nRedLocal, tInt nGreenLocal, tInt nBlueLocal, tInt nAlphaLocal=255)
constructor with several init parameters.
static const cColor Green
definition of color green
tUInt8 GetGreen() const
Returns the value for the green channel.
static tResult ColorFromString(const tChar *strColor, cColor &oColor)
Converts a hexadecimal color value into a cColor object The input format is like the HTML color defin...
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.