Implemented by
[scriptable, uuid(3e7d5d06-8846-4cff-8739-44756cbf494f)]
interface nsIDOMCanvasRenderingContext2D : nsISupports
Constants
const
unsigned long
DRAWWINDOW_DRAW_CARET = 1
const
unsigned long
DRAWWINDOW_DO_NOT_FLUSH = 2
Attributes
readonly attribute
nsIDOMHTMLCanvasElement
canvas
attribute
nsIVariant
fillStyle
attribute
DOMString
font
attribute
float
globalAlpha
attribute
DOMString
globalCompositeOperation
attribute
DOMString
lineCap
attribute
DOMString
lineJoin
attribute
float
lineWidth
attribute
float
miterLimit
attribute
boolean
mozImageSmoothingEnabled
attribute
DOMString
mozTextStyle
attribute
float
shadowBlur
attribute
DOMString
shadowColor
attribute
float
shadowOffsetX
attribute
float
shadowOffsetY
attribute
nsIVariant
strokeStyle
attribute
DOMString
textAlign
attribute
DOMString
textBaseline
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()
void
createImageData()
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()). @param flags Uused to better control the drawWindow call. Flags can be ORed together. 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 float x, in float y, in float w, in float h, in DOMString bgColor, [optional] in unsigned long flags)
void
fill()
void
fillRect(in float x, in float y, in float w, in float h)
void
fillText(in DOMString text, in float x, in float y, [optional] in float maxWidth)
void
getImageData()
boolean
isPointInPath(in float x, in float y)
void
lineTo(in float x, in float y)
nsIDOMTextMetrics
measureText(in DOMString text)
void
moveTo(in float x, in float y)
void
mozDrawText(in DOMString textToDraw)
float
mozMeasureText(in DOMString textToMeasure)
void
mozPathText(in DOMString textToPath)
void
mozTextAlongPath(in DOMString textToDraw, in boolean stroke)
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
setTransform(in float m11, in float m12, in float m21, in float m22, in float dx, in float dy)
void
stroke()
void
strokeRect(in float x, in float y, in float w, in float h)
void
strokeText(in DOMString text, in float x, in float y, [optional] in float maxWidth)
void
transform(in float m11, in float m12, in float m21, in float m22, in float dx, in float dy)
void
translate(in float x, in float y)
Compare to: