#include <arsrgbcolor.h>
Public Member Functions | |
| RGBColor (const unsigned char r, const unsigned char g, const unsigned char b, const unsigned char a=0xFF) | |
| RGBColor (const Uint32 *pColorValue, const SDL_PixelFormat *pFormat) | |
| unsigned long int | SDLColor (SDL_PixelFormat *pFormat) const |
| bool | operator== (const RGBColor &c) const |
| bool | operator!= (const RGBColor &c) const |
| RGBColor & | operator= (const RGBColor &c) |
| Assignment operator. | |
| RGBColor | operator+ (const RGBColor &c) const |
| Does standard color mixing. | |
| RGBColor | operator| (const RGBColor &c) const |
| Does OR color mixing. | |
| RGBColor | operator & (const RGBColor &c) const |
| Does AND color mixing. | |
| RGBColor | operator^ (const RGBColor &c) const |
| Does XOR color mixing. | |
| RGBColor | FadeColor (const int factor) const |
Data Fields | |
| unsigned char | red |
| Red component of the color. | |
| unsigned char | green |
| Green component of the color. | |
| unsigned char | blue |
| Blue component of the color. | |
| unsigned char | alpha |
| Alpha component (or opacity) of the color. | |
|
||||||||||||||||||||
|
Construct a new color object
Definition at line 18 of file arsrgbcolor.h. References alpha, blue, green, and red. Referenced by FadeColor(), operator &(), operator+(), operator^(), and operator|().
|
|
||||||||||||
|
Construct a CRGBColor object from an SDL Color
Definition at line 5 of file arsrgbcolor.cpp. References alpha, blue, green, and red.
00006 {
00007 red = static_cast<unsigned char>((pFormat->Rmask & *pColorValue) >> pFormat->Rshift);
00008 green = static_cast<unsigned char>((pFormat->Gmask & *pColorValue) >> pFormat->Gshift);
00009 blue = static_cast<unsigned char>((pFormat->Bmask & *pColorValue) >> pFormat->Bshift);
00010 alpha = static_cast<unsigned char>((pFormat->Amask & *pColorValue) >> pFormat->Ashift);
00011 }
|
|
|
Definition at line 52 of file arsrgbcolor.cpp. References blue, green, red, and RGBColor(). Referenced by Ars::XEditBox::Draw(), Ars::XCheckBox::Draw(), Ars::XBox::Draw(), Ars::XBox::DrawRaised(), and Ars::XBox::DrawSunken().
00053 {
00054 return RGBColor( max( 0 , min( 0xff , red + factor ) ) , max( 0 , min( 0xff , green + factor ) ) , max( 0 , min( 0xff , blue + factor ) ) );
00055 }
|
|
|
Does AND color mixing.
Definition at line 41 of file arsrgbcolor.cpp. References alpha, blue, green, red, and RGBColor().
00042 {
00043 return RGBColor(red & c.red, green & c.green, blue & c.blue, alpha & c.alpha);
00044 }
|
|
|
Inequality operator does not take into accoutn alpha values
Definition at line 36 of file arsrgbcolor.h. References blue, green, and red.
|
|
|
Does standard color mixing.
Definition at line 24 of file arsrgbcolor.cpp. References alpha, blue, green, red, and RGBColor().
00025 {
00026 double fg_ratio = static_cast<double>(c.alpha) / 0xFF;
00027 double bg_ratio = static_cast<double>(0xFF - c.alpha) / 0xFF;
00028 unsigned char new_red = static_cast<unsigned char>(red * bg_ratio + c.red * fg_ratio);
00029 unsigned char new_green = static_cast<unsigned char>(green * bg_ratio + c.green * fg_ratio);
00030 unsigned char new_blue = static_cast<unsigned char>(blue * bg_ratio + c.blue * fg_ratio);
00031 return RGBColor(new_red, new_green, new_blue, alpha);
00032 }
|
|
|
Assignment operator.
Definition at line 14 of file arsrgbcolor.cpp. References alpha, blue, green, and red.
|
|
|
Comparison operator does not take into account alpha values
Definition at line 32 of file arsrgbcolor.h. References blue, green, and red.
|
|
|
Does XOR color mixing.
Definition at line 47 of file arsrgbcolor.cpp. References alpha, blue, green, red, and RGBColor().
00048 {
00049 return RGBColor(red ^ c.red, green ^ c.green, blue ^ c.blue, alpha ^ c.alpha);
00050 }
|
|
|
Does OR color mixing.
Definition at line 35 of file arsrgbcolor.cpp. References alpha, blue, green, red, and RGBColor().
00036 {
00037 return RGBColor(red | c.red, green | c.green, blue | c.blue, alpha | c.alpha);
00038 }
|
|
|
Convert the color so an SDL Color
Definition at line 28 of file arsrgbcolor.h. References alpha, blue, green, and red. Referenced by Ars::HPaint::DrawHLine(), Ars::HPaint::DrawPoint(), Ars::HPaint::DrawRect(), Ars::HPaint::DrawVLine(), and Ars::HPaint::TransparentColor().
00028 { return SDL_MapRGBA(pFormat, red, green, blue, alpha); }
|
|
|
Alpha component (or opacity) of the color.
Definition at line 11 of file arsrgbcolor.h. Referenced by Cfg::Handler::GetCfgColorHex(), Ars::Rsrc::GetColor(), operator &(), operator+(), operator=(), operator^(), operator|(), RGBColor(), SDLColor(), and Cfg::Handler::SetCfgColorHex(). |
|
|
Blue component of the color.
Definition at line 10 of file arsrgbcolor.h. Referenced by Ars::HPaint::_TextOut(), FadeColor(), Cfg::Handler::GetCfgColorHex(), Ars::Rsrc::GetColor(), operator &(), operator!=(), operator+(), operator=(), operator==(), operator^(), operator|(), RGBColor(), SDLColor(), and Cfg::Handler::SetCfgColorHex(). |
|
|
Green component of the color.
Definition at line 9 of file arsrgbcolor.h. Referenced by Ars::HPaint::_TextOut(), FadeColor(), Cfg::Handler::GetCfgColorHex(), Ars::Rsrc::GetColor(), operator &(), operator!=(), operator+(), operator=(), operator==(), operator^(), operator|(), RGBColor(), SDLColor(), and Cfg::Handler::SetCfgColorHex(). |
|
|
Red component of the color.
Definition at line 8 of file arsrgbcolor.h. Referenced by Ars::HPaint::_TextOut(), FadeColor(), Cfg::Handler::GetCfgColorHex(), Ars::Rsrc::GetColor(), operator &(), operator!=(), operator+(), operator=(), operator==(), operator^(), operator|(), RGBColor(), SDLColor(), and Cfg::Handler::SetCfgColorHex(). |
1.3.3