#include <sdlcolor.h>
Inheritance diagram for Wt::SDLColor:
Public Types | |
Transparent = SDL_ALPHA_TRANSPARENT | |
Opaque = SDL_ALPHA_OPAQUE | |
enum | { Transparent = SDL_ALPHA_TRANSPARENT, Opaque = SDL_ALPHA_OPAQUE } |
The alpha channel values for transparent and opaque. More... | |
Public Member Functions | |
SDLColor () | |
Default constructor (opaque black). | |
SDLColor (int red, int green, int blue, int alpha=Opaque) | |
Construct from a triple/quadruple. (R, G, B, A). | |
SDLColor (const SDL_Color &color) | |
constructor from a base object | |
SDLColor & | operator= (const SDL_Color &color) |
assign operator | |
operator const SDL_Color & () const | |
operator SDL_Color & () | |
int | red () const |
int | green () const |
int | blue () const |
int | alpha () const |
void | setRed (int red) |
void | setGreen (int green) |
void | setBlue (int blue) |
void | setAlpha (int alpha) |
void | setColor (int red, int green, int blue, int alpha) |
bool | equals (const SDLColor &other) const |
Compares colors (without alpha channel !). | |
bool | operator== (const SDLColor &other) const |
bool | operator!= (const SDLColor &other) const |
Inequality comparison. | |
Static Public Member Functions | |
static void | calcBlendFactors (int factor, int &new_factor, int &old_factor) |
static SDLColor | blend (const SDLColor &old_color, int old_factor, const SDLColor &new_color, int new_factor, int new_alpha_factor=Transparent, int old_alpha_factor=Opaque) |
Private Attributes | |
SDL_Color | sdl_color |
Definition at line 37 of file sdlcolor.h.
anonymous enum |
The alpha channel values for transparent and opaque.
Definition at line 111 of file sdlcolor.h.
00111 { 00112 Transparent = SDL_ALPHA_TRANSPARENT, 00113 Opaque = SDL_ALPHA_OPAQUE 00114 };
Wt::SDLColor::SDLColor | ( | ) | [inline] |
Default constructor (opaque black).
Definition at line 40 of file sdlcolor.h.
References Opaque, and setColor().
Referenced by blend().
00040 { 00041 assert(sizeof(SDLColor) == sizeof(SDL_Color)); 00042 setColor(0, 0, 0, Opaque); 00043 }
Here is the call graph for this function:
Construct from a triple/quadruple. (R, G, B, A).
Definition at line 46 of file sdlcolor.h.
References alpha(), blue(), green(), red(), and setColor().
00046 { 00047 assert(sizeof(SDLColor) == sizeof(SDL_Color)); 00048 setColor(red, green, blue, alpha); 00049 }
Here is the call graph for this function:
Wt::SDLColor::SDLColor | ( | const SDL_Color & | color | ) | [inline] |
int Wt::SDLColor::alpha | ( | ) | const [inline] |
Definition at line 83 of file sdlcolor.h.
References sdl_color.
Referenced by blend(), Wt::PixmapOf< Wt::SDLSurface >::blitAlphaBlend(), Wt::Painter::drawText(), Wt::SDLPixelFormat::mapToPixelValue(), Wt::operator<<(), SDLColor(), setAlpha(), and setColor().
00083 { 00084 return sdl_color.unused; 00085 }
static SDLColor Wt::SDLColor::blend | ( | const SDLColor & | old_color, | |
int | old_factor, | |||
const SDLColor & | new_color, | |||
int | new_factor, | |||
int | new_alpha_factor = Transparent , |
|||
int | old_alpha_factor = Opaque | |||
) | [inline, static] |
Definition at line 140 of file sdlcolor.h.
References alpha(), blue(), green(), red(), and SDLColor().
Referenced by Wt::PixmapOf< Wt::SDLSurface >::blend(), and Wt::PixmapOf< Wt::SDLSurface >::blitAlphaBlend().
00142 { 00143 00144 return SDLColor((new_factor * new_color.red() + old_factor * old_color.red()) / 255, 00145 (new_factor * new_color.green() + old_factor * old_color.green()) / 255, 00146 (new_factor * new_color.blue() + old_factor * old_color.blue()) / 255, 00147 (new_alpha_factor * new_color.alpha() + old_alpha_factor * old_color.alpha()) / 255); 00148 }
Here is the call graph for this function:
int Wt::SDLColor::blue | ( | ) | const [inline] |
Definition at line 79 of file sdlcolor.h.
References sdl_color.
Referenced by blend(), Wt::SDLPixelFormat::mapToPixelValue(), Wt::operator<<(), SDLColor(), setBlue(), and setColor().
00079 { 00080 return sdl_color.b; 00081 }
static void Wt::SDLColor::calcBlendFactors | ( | int | factor, | |
int & | new_factor, | |||
int & | old_factor | |||
) | [inline, static] |
Definition at line 132 of file sdlcolor.h.
References Opaque.
Referenced by Wt::PixmapOf< Wt::SDLSurface >::blend(), and Wt::PixmapOf< Wt::SDLSurface >::blitAlphaBlend().
00132 { 00133 // it won't work in previous SDL 00134 assert(Opaque); 00135 // transparent == 0 00136 new_factor = factor; 00137 old_factor = Opaque - new_factor; 00138 }
bool Wt::SDLColor::equals | ( | const SDLColor & | other | ) | const [inline] |
int Wt::SDLColor::green | ( | ) | const [inline] |
Definition at line 75 of file sdlcolor.h.
References sdl_color.
Referenced by blend(), Wt::SDLPixelFormat::mapToPixelValue(), Wt::operator<<(), SDLColor(), setColor(), and setGreen().
00075 { 00076 return sdl_color.g; 00077 }
Wt::SDLColor::operator const SDL_Color & | ( | ) | const [inline] |
Definition at line 63 of file sdlcolor.h.
References sdl_color.
00063 { 00064 return sdl_color; 00065 }
Wt::SDLColor::operator SDL_Color & | ( | ) | [inline] |
Definition at line 67 of file sdlcolor.h.
References sdl_color.
00067 { 00068 return sdl_color; 00069 }
bool Wt::SDLColor::operator!= | ( | const SDLColor & | other | ) | const [inline] |
SDLColor& Wt::SDLColor::operator= | ( | const SDL_Color & | color | ) | [inline] |
assign operator
Definition at line 58 of file sdlcolor.h.
References sdl_color.
00058 { 00059 sdl_color = color; 00060 return *this; 00061 }
bool Wt::SDLColor::operator== | ( | const SDLColor & | other | ) | const [inline] |
Definition at line 123 of file sdlcolor.h.
References sdl_color.
00123 { 00124 return (memcmp(&sdl_color, &other.sdl_color, sizeof(SDL_Color)) == 0); 00125 }
int Wt::SDLColor::red | ( | ) | const [inline] |
Definition at line 71 of file sdlcolor.h.
References sdl_color.
Referenced by blend(), Wt::SDLPixelFormat::mapToPixelValue(), Wt::operator<<(), SDLColor(), setColor(), and setRed().
00071 { 00072 return sdl_color.r; 00073 }
void Wt::SDLColor::setAlpha | ( | int | alpha | ) | [inline] |
Definition at line 99 of file sdlcolor.h.
References alpha(), and sdl_color.
Referenced by Wt::PushButton::drawButton(), and setColor().
Here is the call graph for this function:
void Wt::SDLColor::setBlue | ( | int | blue | ) | [inline] |
Definition at line 95 of file sdlcolor.h.
References blue(), and sdl_color.
Referenced by setColor().
Here is the call graph for this function:
Definition at line 103 of file sdlcolor.h.
References alpha(), blue(), green(), red(), setAlpha(), setBlue(), setGreen(), and setRed().
Referenced by SDLColor().
00103 { 00104 setRed(red); 00105 setGreen(green); 00106 setBlue(blue); 00107 setAlpha(alpha); 00108 }
Here is the call graph for this function:
void Wt::SDLColor::setGreen | ( | int | green | ) | [inline] |
Definition at line 91 of file sdlcolor.h.
References green(), and sdl_color.
Referenced by setColor().
Here is the call graph for this function:
void Wt::SDLColor::setRed | ( | int | red | ) | [inline] |
Definition at line 87 of file sdlcolor.h.
References red(), and sdl_color.
Referenced by setColor().
Here is the call graph for this function:
SDL_Color Wt::SDLColor::sdl_color [private] |
Definition at line 151 of file sdlcolor.h.
Referenced by alpha(), blue(), equals(), green(), operator const SDL_Color &(), operator SDL_Color &(), operator=(), operator==(), red(), setAlpha(), setBlue(), setGreen(), and setRed().
This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.