Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
nsCanvasGradient Class Reference
Inheritance diagram for nsCanvasGradient:
Inheritance graph
Collaboration diagram for nsCanvasGradient:
Collaboration graph

List of all members.

Public Member Functions

 nsCanvasGradient (cairo_pattern_t *cpat, nsICSSParser *cssparser)
 ~nsCanvasGradient ()
void Apply (cairo_t *cairo)
NS_IMETHOD AddColorStop (float offset, const nsAString &colorstr)
void addColorStop (in float offset, in DOMString color)

Protected Attributes

cairo_pattern_t * mPattern
nsCOMPtr< nsICSSParsermCSSParser

Detailed Description

Definition at line 225 of file nsCanvasRenderingContext2D.cpp.

Constructor & Destructor Documentation

nsCanvasGradient::nsCanvasGradient ( cairo_pattern_t *  cpat,
nsICSSParser cssparser 
) [inline]

Definition at line 234 of file nsCanvasRenderingContext2D.cpp.

        : mPattern(cpat), mCSSParser(cssparser)

Member Function Documentation

void nsIDOMCanvasGradient::addColorStop ( in float  offset,
in DOMString  color 
) [inherited]
NS_IMETHOD nsCanvasGradient::AddColorStop ( float  offset,
const nsAString &  colorstr 
) [inline]

Definition at line 249 of file nsCanvasRenderingContext2D.cpp.

        nscolor color;

        if (!FloatValidate(offset))
            return NS_ERROR_DOM_SYNTAX_ERR;

        if (offset < 0.0 || offset > 1.0)
            return NS_ERROR_DOM_INDEX_SIZE_ERR;

        nsresult rv = mCSSParser->ParseColorString(nsString(colorstr), nsnull, 0, PR_TRUE, &color);
        if (NS_FAILED(rv))
            return NS_ERROR_DOM_SYNTAX_ERR;

        cairo_pattern_add_color_stop_rgba (mPattern, (double) offset,
                                           NS_GET_R(color) / 255.0,
                                           NS_GET_G(color) / 255.0,
                                           NS_GET_B(color) / 255.0,
                                           NS_GET_A(color) / 255.0);
        return NS_OK;

Here is the call graph for this function:

void nsCanvasGradient::Apply ( cairo_t *  cairo) [inline]

Definition at line 244 of file nsCanvasRenderingContext2D.cpp.

        cairo_set_source(cairo, mPattern);

Member Data Documentation

Definition at line 276 of file nsCanvasRenderingContext2D.cpp.

cairo_pattern_t* nsCanvasGradient::mPattern [protected]

Definition at line 275 of file nsCanvasRenderingContext2D.cpp.

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