Class

org.scalajs.dom

CanvasRenderingContext2D

Related Doc: package dom

Permalink

class CanvasRenderingContext2D extends Object

The 2D rendering context for the drawing surface of a <canvas> element. To get this object, call getContext() on a <canvas>, supplying "2d" as the argument:

Annotations
@JSType() @native() @JSGlobal()
Linear Supertypes
Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CanvasRenderingContext2D
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CanvasRenderingContext2D()

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def arc(x: Double, y: Double, radius: Double, startAngle: Double, endAngle: Double): Unit

    Permalink

    Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).

  5. def arc(x: Double, y: Double, radius: Double, startAngle: Double, endAngle: Double, anticlockwise: Boolean): Unit

    Permalink
  6. def arcTo(x1: Double, y1: Double, x2: Double, y2: Double, radius: Double): Unit

    Permalink

    Adds an arc with the given control points and radius, connected to the previous point by a straight line.

  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def beginPath(): Unit

    Permalink

    Starts a new path by resetting the list of sub-paths.

    Starts a new path by resetting the list of sub-paths. Call this method when you want to create a new path.

  9. def bezierCurveTo(cp1x: Double, cp1y: Double, cp2x: Double, cp2y: Double, x: Double, y: Double): Unit

    Permalink
  10. var canvas: HTMLCanvasElement

    Permalink

    Back-reference to the canvas element for which this context was created.

    Back-reference to the canvas element for which this context was created. Read only.

  11. def clearRect(x: Double, y: Double, w: Double, h: Double): Unit

    Permalink

    Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black.

  12. def clip(fillRule: String = js.native): Unit

    Permalink

    Creates a clipping path from the current sub-paths.

    Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the clipping path only. For an example, see Clipping paths in the Canvas tutorial.

  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def closePath(): Unit

    Permalink

    Tries to draw a straight line from the current point to the start.

    Tries to draw a straight line from the current point to the start. If the shape has already been closed or has only one point, this function does nothing.

  15. def createImageData(imageDataOrSw: Any, sh: Double = js.native): ImageData

    Permalink

    Creates a new, blank ImageData object with the specified dimensions.

    Creates a new, blank ImageData object with the specified dimensions. All of the pixels in the new object are transparent black.

  16. def createLinearGradient(x0: Double, y0: Double, x1: Double, y1: Double): CanvasGradient

    Permalink
  17. def createPattern(image: HTMLElement, repetition: String): CanvasPattern

    Permalink
  18. def createRadialGradient(x0: Double, y0: Double, r0: Double, x1: Double, y1: Double, r1: Double): CanvasGradient

    Permalink
  19. def drawImage(image: HTMLElement, offsetX: Double, offsetY: Double, width: Double = js.native, height: Double = js.native, canvasOffsetX: Double = js.native, canvasOffsetY: Double = js.native, canvasImageWidth: Double = js.native, canvasImageHeight: Double = js.native): Unit

    Permalink

    Draws the specified image.

    Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.

  20. def ellipse(x: Double, y: Double, radiusX: Double, radiusY: Double, rotation: Double, startAngle: Double, endAngle: Double, anticlockwise: Boolean = js.native): Unit

    Permalink

    The ellipse() method creates an elliptical arc centered at (x, y) with the radii radiusX and radiusY.

    The ellipse() method creates an elliptical arc centered at (x, y) with the radii radiusX and radiusY. The path starts at startAngle and ends at endAngle, and travels in the direction given by anticlockwise (defaulting to clockwise).

  21. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  23. def fill(): Unit

    Permalink

    Fills the subpaths with the current fill style.

  24. def fillRect(x: Double, y: Double, w: Double, h: Double): Unit

    Permalink

    Draws a filled rectangle at (x, y) position whose size is determined by width and height.

  25. var fillStyle: Any

    Permalink

    A CSS color, a CanvasGradient or CanvasPattern, to use as a fill.

  26. def fillText(text: String, x: Double, y: Double, maxWidth: Double = js.native): Unit

    Permalink
  27. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  28. var font: String

    Permalink

    Default value 10px sans-serif

  29. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  30. def getImageData(sx: Double, sy: Double, sw: Double, sh: Double): ImageData

    Permalink

    Returns an ImageData object representing the underlying pixel data for the area of the canvas denoted by the rectangle which starts at (sx, sy) and has an sw width and sh height.

  31. def getLineDash(): Array[Double]

    Permalink

    Returns a dash list array containing an even number of non-negative numbers.

  32. var globalAlpha: Double

    Permalink

    Alpha value that is applied to shapes and images before they are composited onto the canvas.

    Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).

  33. var globalCompositeOperation: String

    Permalink

    With globalAlpha applied this sets how shapes and images are drawn onto the existing bitmap.

    With globalAlpha applied this sets how shapes and images are drawn onto the existing bitmap. Possible values: source-atop source-in source-out source-over (default) destination-atop destination-in destination-out destination-over lighter darker copy xor

  34. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  35. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  36. var imageSmoothingEnabled: Boolean

    Permalink

    A boolean value indicating whether to smooth scaled images or not.

    A boolean value indicating whether to smooth scaled images or not. The default value is true.

  37. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  38. def isPointInPath(x: Double, y: Double): Boolean

    Permalink

    Reports whether or not the specified point is contained in the current path.

  39. def isPointInPath(x: Double, y: Double, fillRule: String): Boolean

    Permalink
  40. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  41. var lineCap: String

    Permalink

    Type of endings on the end of lines.

    Type of endings on the end of lines. Possible values: butt (default), round, square

  42. var lineDashOffset: Double

    Permalink

    Specifies where to start a dasharray on a line.

  43. var lineJoin: String

    Permalink

    Defines the type of corners where two lines meet.

    Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default)

  44. def lineTo(x: Double, y: Double): Unit

    Permalink

    Connects the last point in the subpath to the x, y coordinates with a straight line.

  45. var lineWidth: Double

    Permalink

    Width of lines.

    Width of lines. Default 1.0

  46. def measureText(text: String): TextMetrics

    Permalink
  47. var miterLimit: Double

    Permalink

    Default 10

  48. def moveTo(x: Double, y: Double): Unit

    Permalink

    Moves the starting point of a new subpath to the (x, y) coordinates.

  49. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  50. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  51. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  52. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  53. def putImageData(imagedata: ImageData, dx: Double, dy: Double, dirtyX: Double = js.native, dirtyY: Double = js.native, dirtyWidth: Double = js.native, dirtyHeight: Double = js.native): Unit

    Permalink
  54. def quadraticCurveTo(cpx: Double, cpy: Double, x: Double, y: Double): Unit

    Permalink
  55. def rect(x: Double, y: Double, w: Double, h: Double): Unit

    Permalink
  56. def restore(): Unit

    Permalink

    Restores the drawing style state to the last element on the 'state stack' saved by save().

  57. def rotate(angle: Double): Unit

    Permalink
  58. def save(): Unit

    Permalink

    Saves the current drawing style state using a stack so you can revert any change you make to it using restore().

  59. def scale(x: Double, y: Double): Unit

    Permalink
  60. def setLineDash(segments: Array[Double]): Unit

    Permalink
  61. def setTransform(m11: Double, m12: Double, m21: Double, m22: Double, dx: Double, dy: Double): Unit

    Permalink
  62. var shadowBlur: Double

    Permalink

    Specifies the blurring effect.

    Specifies the blurring effect. Default 0

  63. var shadowColor: String

    Permalink

    Color of the shadow.

    Color of the shadow. Default fully-transparent black.

  64. var shadowOffsetX: Double

    Permalink

    Horizontal distance the shadow will be offset.

    Horizontal distance the shadow will be offset. Default 0.

  65. var shadowOffsetY: Double

    Permalink

    Vertical distance the shadow will be offset.

    Vertical distance the shadow will be offset. Default 0.

  66. def stroke(): Unit

    Permalink

    Strokes the subpaths with the current stroke style.

  67. def strokeRect(x: Double, y: Double, w: Double, h: Double): Unit

    Permalink

    Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.

  68. var strokeStyle: Any

    Permalink

    A CSS color, a CanvasGradient or CanvasPattern, to use as a line around shapes.

  69. def strokeText(text: String, x: Double, y: Double, maxWidth: Double = js.native): Unit

    Permalink
  70. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  71. var textAlign: String

    Permalink

    Possible values: start (default), end, left, right or center.

  72. var textBaseline: String

    Permalink

    Possible values: top, hanging, middle, alphabetic (default), ideographic, bottom

  73. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  74. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  75. def transform(m11: Double, m12: Double, m21: Double, m22: Double, dx: Double, dy: Double): Unit

    Permalink
  76. def translate(x: Double, y: Double): Unit

    Permalink

    Moves the origin point of the context to (x, y).

  77. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  78. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  79. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  80. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped