A color value, storing red, green, blue and alpha components. More...
#include <gfxColor.h>
Public Types | |
enum | PackedColorType { PACKED_ABGR, PACKED_ABGR_PREMULTIPLIED, PACKED_ARGB, PACKED_ARGB_PREMULTIPLIED, PACKED_XBGR, PACKED_XRGB } |
Public Member Functions | |
gfxRGBA () | |
gfxRGBA (const gfxRGBA &c) | |
gfxRGBA (gfxFloat _r, gfxFloat _g, gfxFloat _b, gfxFloat _a=1.0) | |
Intialize this color using explicit red, green, blue and alpha values. | |
gfxRGBA (PRUint32 c, PackedColorType colorType=PACKED_ABGR) | |
Initialize this color from a packed 32-bit color. | |
bool | operator== (const gfxRGBA &other) const |
Initialize this color by parsing the given string. | |
PRUint32 | Packed (PackedColorType colorType=PACKED_ABGR) const |
Returns this color value as a packed 32-bit integer. | |
Public Attributes | |
gfxFloat | r |
gfxFloat | g |
gfxFloat | b |
gfxFloat | a |
A color value, storing red, green, blue and alpha components.
This class does not use premultiplied alpha.
XXX should this use doubles (instead of gfxFloat), for consistency with cairo?
gfxRGBA::gfxRGBA | ( | ) | [inline] |
gfxRGBA::gfxRGBA | ( | const gfxRGBA & | c | ) | [inline] |
Intialize this color using explicit red, green, blue and alpha values.
gfxRGBA::gfxRGBA | ( | PRUint32 | c, | |
PackedColorType | colorType = PACKED_ABGR | |||
) | [inline] |
Initialize this color from a packed 32-bit color.
The color value is interpreted based on colorType; all values use the native platform endianness.
Initialize this color by parsing the given string.
XXX implement me!
PRUint32 gfxRGBA::Packed | ( | PackedColorType | colorType = PACKED_ABGR |
) | const [inline] |
Returns this color value as a packed 32-bit integer.
This reconstructs the int32 based on the given colorType, always in the native byte order.
Note: gcc 4.2.3 on at least Ubuntu (x86) does something strange with (PRUint8)(c * 255.0) << x, where the result is different than double d = c * 255.0; v = ((PRUint8) d) << x.