Class Fz2D.Texture

Defined in: src/renderer/texture.coffee

Overview

Public: Texture

Instance Method Summary

Constructor Details

::constructor(image = null, x = 0, y = 0, w = null, h = null) Source

Public: Constructor. image - color, instance of an image HTML DOM element or another Fz2D.Texture x - source position on the X axis (default: 0) y - source position on the Y axis (default: 0) w - source width (default: image width) h - source height (default: image height)

Parameters:

  • (Fz2D.Texture) imagecolor, instance of an image HTML DOM element or another Fz2D.Texture
  • xsource position on the X axis (default: 0)
  • ysource position on the Y axis (default: 0)
  • wsource width (default: image width)
  • hsource height (default: image height)

Instance Method Details

Fz2D.Texture ::getSubTexture(x, y, w, h) Source

Public: Creates a Sub Texture from a Texture. x - source position on the X axis (default: 0) y - source position on the Y axis (default: 0) w - source width (default: texture height) h - source height (default: texture height) Returns a Fz2D.Texture pointng to the same image.

Parameters:

  • xsource position on the X axis (default: 0)
  • ysource position on the Y axis (default: 0)
  • wsource width (default: texture height)
  • hsource height (default: texture height)

Returns:

::load(path) Source

Public: Loads and image. path - relative path

Parameters:

  • pathrelative path

::onload(texture) Source

Public: On load(ed) callback. texture - Fz2D.Texture

Parameters:

::toImage() Source

Public: Returns "native" image instance.