Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
gfxRGBA Struct Reference

#include <gfxColor.h>

List of all members.

Public Member Functions

 gfxRGBA ()
 gfxRGBA (const gfxRGBA &c)
 gfxRGBA (gfxFloat _r, gfxFloat _g, gfxFloat _b, gfxFloat _a=1.0)
 gfxRGBA (PRUint32 c)
 gfxRGBA (const char *str)
PRUint32 Packed () const
void Hex (nsACString &result) const

Public Attributes

gfxFloat r
gfxFloat g
gfxFloat b
gfxFloat a

Detailed Description

Definition at line 45 of file gfxColor.h.


Constructor & Destructor Documentation

gfxRGBA::gfxRGBA ( ) [inline]

Definition at line 48 of file gfxColor.h.

{ }
gfxRGBA::gfxRGBA ( const gfxRGBA c) [inline]

Definition at line 49 of file gfxColor.h.

: r(c.r), g(c.g), b(c.b), a(c.a) {}
gfxRGBA::gfxRGBA ( gfxFloat  _r,
gfxFloat  _g,
gfxFloat  _b,
gfxFloat  _a = 1.0 
) [inline]

Definition at line 50 of file gfxColor.h.

: r(_r), g(_g), b(_b), a(_a) {}
gfxRGBA::gfxRGBA ( PRUint32  c) [inline]

Definition at line 51 of file gfxColor.h.

                        {
        r = ((c >> 0) & 0xff) / 255.0;
        g = ((c >> 8) & 0xff) / 255.0;
        b = ((c >> 16) & 0xff) / 255.0;
        a = ((c >> 24) & 0xff) / 255.0;
    }
gfxRGBA::gfxRGBA ( const char *  str) [inline]

Definition at line 57 of file gfxColor.h.

                             {
        a = 1.0;
        // if aString[0] is a #, parse it as hex
        // if aString[0] is a letter, parse it as a color name
        // if aString[0] is a number, parse it loosely as hex
    }

Member Function Documentation

void gfxRGBA::Hex ( nsACString &  result) const [inline]

Definition at line 73 of file gfxColor.h.

                                       {
        nsPrintfCString hex(8, "%02x%02x%02x", PRUint8(r*255.0), PRUint8(g*255.0), PRUint8(b*255.0));
        result.Assign(hex);
    }
PRUint32 gfxRGBA::Packed ( ) const [inline]

Definition at line 64 of file gfxColor.h.

                            {
        return (((PRUint8)(a * 255.0) << 24) |
                ((PRUint8)(b * 255.0) << 16) |
                ((PRUint8)(g * 255.0) << 8) |
                ((PRUint8)(r * 255.0)));
    }

Member Data Documentation

Definition at line 46 of file gfxColor.h.

Definition at line 46 of file gfxColor.h.

Definition at line 46 of file gfxColor.h.

Definition at line 46 of file gfxColor.h.


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