Mixin: Canvas

Defined in: src/drawing/adaptor/mixin/canvas.coffee

Overview

Utility functions for handling HTMLCanvasElements.

Method Summary

Method Details

? (HTMLCanvasElement) colourise(image, colour, dimensions)

Colourise an image.

Parameters:

  • image (Image) A JavaScript image object (loaded)
  • colour (String) A colour in hex format
  • dimensions (Object) Dimensions of the canvas to draw on, width:<Integer>, height:<Integer>

Returns:

  • (HTMLCanvasElement) — A canvas drawn with the colourised image

? (HTMLCanvasElement) canvasWithDimensions(dimensions)

Get a new HTMLCanvasElement

Parameters:

  • dimensions (Object) Dimensions of the canvas to draw on, width:<Integer>, height:<Integer>

Returns:

  • (HTMLCanvasElement) — A new canvas

? (void) getColourisingCanvas(colour, dimensions) (private)