Trait

io.scalajs.dom.html.canvas

CanvasRenderingContext2D

Related Doc: package canvas

Permalink

trait CanvasRenderingContext2D extends Object with RenderingContext

The CanvasRenderingContext2D interface is used for drawing rectangles, text, images and other objects onto the canvas element. It provides the 2D rendering context for the drawing surface of a <canvas> element.

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

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. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clearRect(x: Double, y: Double, width: Double, height: Double): Unit

    Permalink

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

  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def drawImage(image: Image, sx: Double, sy: Double, sWidth: Double, sHeight: Double, dx: Double, dy: Double, dwidth: Double, dheight: Double): Unit

    Permalink

    The CanvasRenderingContext2D.drawImage() method of the Canvas 2D API provides different ways to draw an image onto the canvas.

    The CanvasRenderingContext2D.drawImage() method of the Canvas 2D API provides different ways to draw an image onto the canvas.

    image

    an element to draw into the context. The specification permits any canvas image source (CanvasImageSource), such as an HTMLImageElement, an HTMLVideoElement, an HTMLCanvasElement or an ImageBitmap.

    sx

    the X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.

    sy

    the Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.

    sWidth

    the width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.

    sHeight

    the height of the sub-rectangle of the source image to draw into the destination context.

    dx

    the X coordinate in the destination canvas at which to place the top-left corner of the source image.

    dy

    the Y coordinate in the destination canvas at which to place the top-left corner of the source image.

    dwidth

    the width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.

    dheight

    the height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.

  8. def drawImage(image: Image, dx: Double, dy: Double, dwidth: Double, dheight: Double): Unit

    Permalink

    The CanvasRenderingContext2D.drawImage() method of the Canvas 2D API provides different ways to draw an image onto the canvas.

    The CanvasRenderingContext2D.drawImage() method of the Canvas 2D API provides different ways to draw an image onto the canvas.

    image

    an element to draw into the context. The specification permits any canvas image source (CanvasImageSource), such as an HTMLImageElement, an HTMLVideoElement, an HTMLCanvasElement or an ImageBitmap.

    dx

    the X coordinate in the destination canvas at which to place the top-left corner of the source image.

    dy

    the Y coordinate in the destination canvas at which to place the top-left corner of the source image.

    dwidth

    the width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.

    dheight

    the height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.

  9. def drawImage(image: Image, dx: Double, dy: Double): Unit

    Permalink

    The CanvasRenderingContext2D.drawImage() method of the Canvas 2D API provides different ways to draw an image onto the canvas.

    The CanvasRenderingContext2D.drawImage() method of the Canvas 2D API provides different ways to draw an image onto the canvas.

    image

    an element to draw into the context. The specification permits any canvas image source (CanvasImageSource), such as an HTMLImageElement, an HTMLVideoElement, an HTMLCanvasElement or an ImageBitmap.

    dx

    the X coordinate in the destination canvas at which to place the top-left corner of the source image.

    dy

    the Y coordinate in the destination canvas at which to place the top-left corner of the source image.

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. def fillRect(x: Double, y: Double, width: Double, height: Double): Unit

    Permalink

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

  13. var fillStyle: String

    Permalink

    The CanvasRenderingContext2D.fillStyle property of the Canvas 2D API specifies the color or style to use inside shapes.

    The CanvasRenderingContext2D.fillStyle property of the Canvas 2D API specifies the color or style to use inside shapes. The default is #000 (black).

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

    Permalink

    Draws (fills) a given text at the given (x,y) position.

  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. def hasOwnProperty(v: String): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  21. def measureText(text: String): TextMetrics

    Permalink

    The CanvasRenderingContext2D.measureText() method returns a TextMetrics object that contains information about the measured text (such as its width for example).

    The CanvasRenderingContext2D.measureText() method returns a TextMetrics object that contains information about the measured text (such as its width for example).

    text

    the text to measure.

    returns

    the text metrics

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

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

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

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

    Permalink
    Definition Classes
    Object
  26. def strokeRect(x: Double, y: Double, width: Double, height: 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.

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

    Permalink

    Draws (strokes) a given text at the given (x, y) position.

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

    Permalink
    Definition Classes
    AnyRef
  29. def toLocaleString(): String

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

    Permalink
    Definition Classes
    AnyRef → Any
  31. def valueOf(): Any

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

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

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

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

Inherited from RenderingContext

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped