Public Types | Public Member Functions | Public Attributes

gfxRGBA Struct Reference

A color value, storing red, green, blue and alpha components. More...

#include <gfxColor.h>

List of all members.

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.
PRUint32 Packed (PackedColorType colorType=PACKED_ABGR) const
 Initialize this color by parsing the given string.

Public Attributes

gfxFloat r
gfxFloat g
gfxFloat b
gfxFloat a

Detailed Description

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?


Member Enumeration Documentation

Enumerator:
PACKED_ABGR 
PACKED_ABGR_PREMULTIPLIED 
PACKED_ARGB 
PACKED_ARGB_PREMULTIPLIED 
PACKED_XBGR 
PACKED_XRGB 

Constructor & Destructor Documentation

gfxRGBA::gfxRGBA (  )  [inline]
gfxRGBA::gfxRGBA ( const gfxRGBA c  )  [inline]
gfxRGBA::gfxRGBA ( gfxFloat  _r,
gfxFloat  _g,
gfxFloat  _b,
gfxFloat  _a = 1.0 
) [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.

See also:
gfxRGBA::Packed

Member Function Documentation

PRUint32 gfxRGBA::Packed ( PackedColorType  colorType = PACKED_ABGR  )  const [inline]

Initialize this color by parsing the given string.

XXX implement me! 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.


Member Data Documentation


The documentation for this struct was generated from the following file: