Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "canvas"

Index

Functions

resize

  • resize(canvas: HTMLCanvasElement, width: number, height: number, resolution?: number): [number, number]
  • Resize a canvas for drawing at the appropriate resolution for the current device. This prevents blurry rendering on retina displays.

    Note: This function scales the context to match the device's pixel ratio. When resolution > 1 the width and height properties on canvas will be scaled too.

    Parameters

    Returns [number, number]

    The width and height of the canvas

resizeToFillScreen

  • resizeToFillScreen(canvas: HTMLCanvasElement, resolution?: number): [number, number]
  • Resize a canvas to fill the screen.

    See resize.

    Parameters

    • canvas: HTMLCanvasElement
    • Default value resolution: number = window.devicePixelRatio

    Returns [number, number]

Generated using TypeDoc