Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ImageUtils

General-purpose utilities for manipulating images in canvases.

constructor

Hierarchy

  • ImageUtils

Index

Methods

Static createCanvas

  • createCanvas(width: number, height: number, parentDiv?: HTMLElement | string): HTMLCanvasElement
  • Parameters

    • width: number
    • height: number
    • Optional parentDiv: HTMLElement | string

    Returns HTMLCanvasElement

Static makeColorTranslucent

  • makeColorTranslucent(canvas: HTMLCanvasElement, x?: number, y?: number): HTMLCanvasElement
  • Converts a color of a particular type to completely transparent in a canvas.

    method

    Parameters

    • canvas: HTMLCanvasElement

      The canvas to operate on.

    • Optional x: number

      The x-coordinate of the pixel whose color to change. 0 will be used if this parameter is undefined.

    • Optional y: number

      The y-coordinate of the pixel whose color to change. 0 will be used if this parameter is undefined.

    Returns HTMLCanvasElement

    The original canvas, which has been modified.

Static prepCanvas

  • prepCanvas(canvas: HTMLCanvasElement): void
  • Parameters

    • canvas: HTMLCanvasElement

    Returns void

Static resize

  • resize(img: HTMLImageElement | HTMLCanvasElement, scale?: number): HTMLCanvasElement
  • Takes an img/canvas and a scaling factor and returns the scaled image.

    method

    Parameters

    • img: HTMLImageElement | HTMLCanvasElement
    • Optional scale: number

    Returns HTMLCanvasElement

Generated using TypeDoc