Public Member Functions | |
| Color () | |
| Color (unsigned char r, unsigned char g, unsigned char b) | |
| Color (const unsigned int value) | |
| Color (const Color &c) | |
| Color (const __Color &c) | |
| Color (const SDL_Color &c) | |
| Color & | operator= (const Color &c) |
| Color & | operator= (const unsigned int long_x) |
| Color & | operator= (const SDL_Color &c) |
| const unsigned int | toInteger () const |
| const SDL_Color | toSDL_Color () const |
Static Public Member Functions | |
| static unsigned int | mapRGB (mx::mxSurface &surface, unsigned char r, unsigned char g, unsigned char b) |
| static unsigned int | mapRGB (mx::mxSurface &surface, const __Color &c) |
| static unsigned int | mapRGB (mx::mxSurface &surface, const Color &c) |
| static unsigned int | mapRGB (SDL_Surface *surface, const Color &c) |
Public Attributes | |
| __Color | color |
Definition at line 63 of file mx_types.h.
| mx::Color::Color | ( | ) |
Default Constructor
Definition at line 26 of file mx_types.cpp.
References color, and mx::__Color::value.
00027 { 00028 00029 color.value = 0; 00030 }
| mx::Color::Color | ( | unsigned char | r, | |
| unsigned char | g, | |||
| unsigned char | b | |||
| ) |
Constructor to init Color object
| r | Red Value | |
| g | Green Value | |
| b | Blue Value |
Definition at line 37 of file mx_types.cpp.
References color, and mx::__Color::colors.
| mx::Color::Color | ( | const unsigned int | value | ) |
Constructor to init Color object
| value | 32bit unsigned integer value |
Definition at line 44 of file mx_types.cpp.
References color, and mx::__Color::value.
00045 { 00046 color.value = value; 00047 }
| mx::Color::Color | ( | const Color & | c | ) |
Copy Constructor
| c | Color value to set this object to |
Definition at line 50 of file mx_types.cpp.
References color.
00051 { 00052 color = c.color; 00053 }
| mx::Color::Color | ( | const __Color & | c | ) |
Constructor
| c | of type __Color sets this color to |
Definition at line 32 of file mx_types.cpp.
References color.
00033 { 00034 color = c; 00035 }
| mx::Color::Color | ( | const SDL_Color & | c | ) |
Construct to take type SDL_Color
| c | of type SDL_Color |
Definition at line 55 of file mx_types.cpp.
References color, and mx::__Color::colors.
00056 { 00057 00058 color.colors[0] = c.r; 00059 color.colors[1] = c.g; 00060 color.colors[2] = c.b; 00061 00062 }
| static unsigned int mx::Color::mapRGB | ( | SDL_Surface * | surface, | |
| const Color & | c | |||
| ) | [inline, static] |
mapRGB map a color from a Color object by a SDL_Surface's pixel format
| surface | a SDL_Surface from which to obtain the SDL_Surface 's pixel format | |
| c | the color from which to obtain the RGB values from |
Definition at line 154 of file mx_types.h.
References color, and mx::__Color::colors.
00154 { 00155 return SDL_MapRGB(surface->format, c.color.colors[0], c.color.colors[1], c.color.colors[2]); 00156 }
| static unsigned int mx::Color::mapRGB | ( | mx::mxSurface & | surface, | |
| const Color & | c | |||
| ) | [inline, static] |
mapRGB map a color from a Color object by a mxSurface's pixel format
| surface | surface from whiich to obtain the pixel format | |
| c | color object from which to map the return value |
Definition at line 144 of file mx_types.h.
References color, and mapRGB().
00145 { 00146 return mapRGB(surface, c.color); 00147 }
| static unsigned int mx::Color::mapRGB | ( | mx::mxSurface & | surface, | |
| const __Color & | c | |||
| ) | [inline, static] |
mapRGB map a color value from a __Color union by a mxSurface's pixel format
| surface | surface from which to obtain the pixelformat | |
| c | __Color value to map |
Definition at line 135 of file mx_types.h.
References mx::__Color::colors, and mx::mxSurface::getSurface().
00136 { 00137 return SDL_MapRGB(surface.getSurface()->format, c.colors[0], c.colors[1], c.colors[2]); 00138 }
| static unsigned int mx::Color::mapRGB | ( | mx::mxSurface & | surface, | |
| unsigned char | r, | |||
| unsigned char | g, | |||
| unsigned char | b | |||
| ) | [inline, static] |
mapRGB map a color value to a format of a specific surface
| surface | surface for pixel format | |
| r | for red value | |
| g | for green value | |
| b | for blue value |
Definition at line 126 of file mx_types.h.
References mx::mxSurface::getSurface().
Referenced by mapRGB(), and mx::mxRegularFont::printText().
00127 { 00128 return SDL_MapRGB(surface.getSurface()->format, r, g, b); 00129 }
| Color & mx::Color::operator= | ( | const SDL_Color & | c | ) |
overloaded assignment operator to this this object's Color value to
| c | SDL_Color value to set this Color objects value to |
Definition at line 77 of file mx_types.cpp.
References color, and mx::__Color::colors.
00078 { 00079 00080 color.colors[0] = c.r; 00081 color.colors[1] = c.g; 00082 color.colors[2] = c.b; 00083 return *this; 00084 }
| Color & mx::Color::operator= | ( | const unsigned int | long_x | ) |
overloaded assignment operator set this object's Color value to
| long_x | value to set color to |
Definition at line 70 of file mx_types.cpp.
References color, and mx::__Color::value.
00071 { 00072 00073 color.value = long_x; 00074 return *this; 00075 00076 }
| const unsigned int mx::Color::toInteger | ( | ) | const |
turns the value of the internal color union to a unsigned integer
Definition at line 94 of file mx_types.cpp.
References color, and mx::__Color::value.
00095 { 00096 return color.value; 00097 }
| const SDL_Color mx::Color::toSDL_Color | ( | ) | const |
turns the value of the internal color union to a SDL_Color
Definition at line 86 of file mx_types.cpp.
References color, and mx::__Color::colors.
00087 { 00088 00089 SDL_Color col = { color.colors[0], color.colors[1], color.colors[2], 0 }; 00090 return col; 00091 00092 }
Color union
Definition at line 118 of file mx_types.h.
Referenced by Color(), mapRGB(), operator=(), toInteger(), and toSDL_Color().
1.5.8