1.26.2.1
Prysm
CanvasRenderingContext2D Interface Reference

Public Member Functions

 attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle
 
 attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle
 
CanvasGradient createLinearGradient (float x0, float y0, float x1, float y1)
 
CanvasGradient createRadialGradient (float x0, float y0, float r0, float x1, float y1, float r1)
 
CanvasPattern createPattern (HTMLCanvasElement image, [TreatNullAs=EmptyString] DOMString repetition)
 
CanvasPattern createPattern (HTMLImageElement image, [TreatNullAs=EmptyString] DOMString repetition)
 
void save ()
 
void restore ()
 
void clearRect (float x, float y, float w, float h)
 
void fillRect (float x, float y, float w, float h)
 
void strokeRect (float x, float y, float w, float h)
 
void fillText (DOMString text, float x, float y, optional float maxWidth)
 
void strokeText (DOMString text, float x, float y, optional float maxWidth)
 
TextMetrics measureText (DOMString text)
 
void drawImage (HTMLCanvasElement image, float dx, float dy)
 
void drawImage (HTMLCanvasElement image, float dx, float dy, float dw, float dh)
 
void drawImage (HTMLCanvasElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
 
void drawImage (HTMLVideoElement image, float dx, float dy)
 
void drawImage (HTMLVideoElement image, float dx, float dy, float dw, float dh)
 
void drawImage (HTMLVideoElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
 
void drawImage (HTMLImageElement image, float dx, float dy)
 
void drawImage (HTMLImageElement image, float dx, float dy, float dw, float dh)
 
void drawImage (HTMLImageElement image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
 
void scale (float x, float y)
 
void rotate (float angle)
 
void translate (float x, float y)
 
void transform (float a, float b, float c, float d, float e, float f)
 
void setTransform (float a, float b, float c, float d, float e, float f)
 
void beginPath ()
 
void fill ()
 
void stroke ()
 
void drawFocusIfNeeded (Element element)
 
void clip ()
 
void closePath ()
 
void moveTo (float x, float y)
 
void lineTo (float x, float y)
 
void quadraticCurveTo (float cpx, float cpy, float x, float y)
 
void bezierCurveTo (float cp1x, float cp1y, float cp2x, float cp2y, float x, float y)
 
void arcTo (float x1, float y1, float x2, float y2, float radius)
 
void rect (float x, float y, float w, float h)
 
void arc (float x, float y, float radius, float startAngle, float endAngle, optional boolean counterclockwise=false)
 

Public Attributes

readonly attribute HTMLCanvasElement canvas
 
attribute float globalAlpha
 
attribute DOMString globalCompositeOperation
 
attribute float lineWidth
 
attribute DOMString lineCap
 
attribute DOMString lineJoin
 
attribute float miterLimit
 
attribute DOMString font
 Specifies the current text style to use when drawing text. This string uses the same syntax as the CSS font specifier. More...
 
attribute DOMString textAlign
 
attribute DOMString textBaseline
 
attribute float shadowOffsetX
 
attribute float shadowOffsetY
 
attribute float shadowBlur
 
attribute DOMString shadowColor
 
attribute boolean enableFastLineSegmentDrawing
 

Member Function Documentation

◆ arc()

void CanvasRenderingContext2D::arc ( float  x,
float  y,
float  radius,
float  startAngle,
float  endAngle,
optional boolean  counterclockwise = false 
)

◆ arcTo()

void CanvasRenderingContext2D::arcTo ( float  x1,
float  y1,
float  x2,
float  y2,
float  radius 
)

◆ attribute() [1/2]

CanvasRenderingContext2D::attribute ( DOMString or CanvasGradient or  CanvasPattern)

◆ attribute() [2/2]

CanvasRenderingContext2D::attribute ( DOMString or CanvasGradient or  CanvasPattern)

◆ beginPath()

void CanvasRenderingContext2D::beginPath ( )

◆ bezierCurveTo()

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

◆ clearRect()

void CanvasRenderingContext2D::clearRect ( float  x,
float  y,
float  w,
float  h 
)

◆ clip()

void CanvasRenderingContext2D::clip ( )

◆ closePath()

void CanvasRenderingContext2D::closePath ( )

◆ createLinearGradient()

CanvasGradient CanvasRenderingContext2D::createLinearGradient ( float  x0,
float  y0,
float  x1,
float  y1 
)

◆ createPattern() [1/2]

CanvasPattern CanvasRenderingContext2D::createPattern ( HTMLCanvasElement  image,
[TreatNullAs=EmptyString] DOMString  repetition 
)

◆ createPattern() [2/2]

CanvasPattern CanvasRenderingContext2D::createPattern ( HTMLImageElement  image,
[TreatNullAs=EmptyString] DOMString  repetition 
)

◆ createRadialGradient()

CanvasGradient CanvasRenderingContext2D::createRadialGradient ( float  x0,
float  y0,
float  r0,
float  x1,
float  y1,
float  r1 
)

◆ drawFocusIfNeeded()

void CanvasRenderingContext2D::drawFocusIfNeeded ( Element  element)

◆ drawImage() [1/9]

void CanvasRenderingContext2D::drawImage ( HTMLCanvasElement  image,
float  dx,
float  dy 
)

◆ drawImage() [2/9]

void CanvasRenderingContext2D::drawImage ( HTMLCanvasElement  image,
float  dx,
float  dy,
float  dw,
float  dh 
)

◆ drawImage() [3/9]

void CanvasRenderingContext2D::drawImage ( HTMLCanvasElement  image,
float  sx,
float  sy,
float  sw,
float  sh,
float  dx,
float  dy,
float  dw,
float  dh 
)

◆ drawImage() [4/9]

void CanvasRenderingContext2D::drawImage ( HTMLVideoElement  image,
float  dx,
float  dy 
)

◆ drawImage() [5/9]

void CanvasRenderingContext2D::drawImage ( HTMLVideoElement  image,
float  dx,
float  dy,
float  dw,
float  dh 
)

◆ drawImage() [6/9]

void CanvasRenderingContext2D::drawImage ( HTMLVideoElement  image,
float  sx,
float  sy,
float  sw,
float  sh,
float  dx,
float  dy,
float  dw,
float  dh 
)

◆ drawImage() [7/9]

void CanvasRenderingContext2D::drawImage ( HTMLImageElement  image,
float  dx,
float  dy 
)

◆ drawImage() [8/9]

void CanvasRenderingContext2D::drawImage ( HTMLImageElement  image,
float  dx,
float  dy,
float  dw,
float  dh 
)

◆ drawImage() [9/9]

void CanvasRenderingContext2D::drawImage ( HTMLImageElement  image,
float  sx,
float  sy,
float  sw,
float  sh,
float  dx,
float  dy,
float  dw,
float  dh 
)

◆ fill()

void CanvasRenderingContext2D::fill ( )

◆ fillRect()

void CanvasRenderingContext2D::fillRect ( float  x,
float  y,
float  w,
float  h 
)

◆ fillText()

void CanvasRenderingContext2D::fillText ( DOMString  text,
float  x,
float  y,
optional float  maxWidth 
)

◆ lineTo()

void CanvasRenderingContext2D::lineTo ( float  x,
float  y 
)

◆ measureText()

TextMetrics CanvasRenderingContext2D::measureText ( DOMString  text)

◆ moveTo()

void CanvasRenderingContext2D::moveTo ( float  x,
float  y 
)

◆ quadraticCurveTo()

void CanvasRenderingContext2D::quadraticCurveTo ( float  cpx,
float  cpy,
float  x,
float  y 
)

◆ rect()

void CanvasRenderingContext2D::rect ( float  x,
float  y,
float  w,
float  h 
)

◆ restore()

void CanvasRenderingContext2D::restore ( )

◆ rotate()

void CanvasRenderingContext2D::rotate ( float  angle)

◆ save()

void CanvasRenderingContext2D::save ( )

◆ scale()

void CanvasRenderingContext2D::scale ( float  x,
float  y 
)

◆ setTransform()

void CanvasRenderingContext2D::setTransform ( float  a,
float  b,
float  c,
float  d,
float  e,
float  f 
)

◆ stroke()

void CanvasRenderingContext2D::stroke ( )

◆ strokeRect()

void CanvasRenderingContext2D::strokeRect ( float  x,
float  y,
float  w,
float  h 
)

◆ strokeText()

void CanvasRenderingContext2D::strokeText ( DOMString  text,
float  x,
float  y,
optional float  maxWidth 
)

◆ transform()

void CanvasRenderingContext2D::transform ( float  a,
float  b,
float  c,
float  d,
float  e,
float  f 
)

◆ translate()

void CanvasRenderingContext2D::translate ( float  x,
float  y 
)

Member Data Documentation

◆ canvas

readonly attribute HTMLCanvasElement CanvasRenderingContext2D::canvas

◆ enableFastLineSegmentDrawing

attribute boolean CanvasRenderingContext2D::enableFastLineSegmentDrawing

◆ font

attribute DOMString CanvasRenderingContext2D::font

Specifies the current text style to use when drawing text. This string uses the same syntax as the CSS font specifier.

Note
Currently supports only "bold", "italic", font-size in pixels and a single font-family. Font fallback is not supported.
Warning
Canvas can only draw with already loaded fonts.

◆ globalAlpha

attribute float CanvasRenderingContext2D::globalAlpha

◆ globalCompositeOperation

attribute DOMString CanvasRenderingContext2D::globalCompositeOperation

◆ lineCap

attribute DOMString CanvasRenderingContext2D::lineCap

◆ lineJoin

attribute DOMString CanvasRenderingContext2D::lineJoin

◆ lineWidth

attribute float CanvasRenderingContext2D::lineWidth

◆ miterLimit

attribute float CanvasRenderingContext2D::miterLimit

◆ shadowBlur

attribute float CanvasRenderingContext2D::shadowBlur

◆ shadowColor

attribute DOMString CanvasRenderingContext2D::shadowColor

◆ shadowOffsetX

attribute float CanvasRenderingContext2D::shadowOffsetX

◆ shadowOffsetY

attribute float CanvasRenderingContext2D::shadowOffsetY

◆ textAlign

attribute DOMString CanvasRenderingContext2D::textAlign

◆ textBaseline

attribute DOMString CanvasRenderingContext2D::textBaseline