Linux Mac OSX Windows

Implemented by


  
[scriptable, uuid(ab27f42d-e1e1-4ef6-9c83-059a81da479b)]
interface nsIDOMCanvasRenderingContext2D : nsISupports

Attributes


        
readonly attribute nsIDOMHTMLCanvasElement canvas

        
attribute nsIVariant fillStyle

        
attribute float globalAlpha

        
attribute DOMString globalCompositeOperation

        
attribute DOMString lineCap

        
attribute DOMString lineJoin

        
attribute float lineWidth

        
attribute float miterLimit

        
attribute float shadowBlur

        
attribute DOMString shadowColor

        
attribute float shadowOffsetX

        
attribute float shadowOffsetY

        
attribute nsIVariant strokeStyle

Methods


        
void arc(in float x, in float y, in float r, in float startAngle, in float endAngle, in boolean clockwise)

        
void arcTo(in float x1, in float y1, in float x2, in float y2, in float radius)

        
void beginPath()

        
void bezierCurveTo(in float cp1x, in float cp1y, in float cp2x, in float cp2y, in float x, in float y)

        
void clearRect(in float x, in float y, in float w, in float h)

        
void clip()

        
void closePath()

        
nsIDOMCanvasGradient createLinearGradient(in float x0, in float y0, in float x1, in float y1)

        
nsIDOMCanvasPattern createPattern(in nsIDOMHTMLElement image, in DOMString repetition)

        
nsIDOMCanvasGradient createRadialGradient(in float x0, in float y0, in float r0, in float x1, in float y1, in float r1)

        
void drawImage()
 Renders a region of a window into the canvas.  The contents of
 the window's viewport are rendered, ignoring viewport clipping
 and scrolling.

 @param x
 @param y
 @param w
 @param h specify the area of the window to render, in CSS
 pixels.

 @param backgroundColor the canvas is filled with this color
 before we render the window into it. This color may be
 transparent/translucent. It is given as a CSS color string
 (e.g., rgb() or rgba()).

 Of course, the rendering obeys the current scale, transform and
 globalAlpha values.

 Hints:
 -- If 'rgba(0,0,0,0)' is used for the background color, the
 drawing will be transparent wherever the window is transparent.
 -- Top-level browsed documents are usually not transparent
 because the user's background-color preference is applied,
 but IFRAMEs are transparent if the page doesn't set a background.
 -- If an opaque color is used for the background color, rendering
 will be faster because we won't have to compute the window's
 transparency.

 This API cannot currently be used by Web content. It is chrome
 only.
void drawWindow(in nsIDOMWindow window, in long x, in long y, in long w, in long h, in DOMString bgColor)

        
void fill()

        
void fillRect(in float x, in float y, in float w, in float h)

        
void getImageData()

        
boolean isPointInPath(in float x, in float y)

        
void lineTo(in float x, in float y)

        
void moveTo(in float x, in float y)

        
void putImageData()

        
void quadraticCurveTo(in float cpx, in float cpy, in float x, in float y)

        
void rect(in float x, in float y, in float w, in float h)

        
void restore()

        
void rotate(in float angle)

        
void save()

        
void scale(in float x, in float y)

        
void stroke()

        
void strokeRect(in float x, in float y, in float w, in float h)

        
void translate(in float x, in float y)