Class: DrawableImage

DrawableImage

new DrawableImage(image, x, y)

Image object wrapped in drawable, restorable if it is loaded via ResourceLoader.
Parameters:
Name Type Description
image Image The image to draw
x number
y number
Implements:

Extends

Members

(static) defaultOptions

(static) effects

Add a new function here if you want custom image processing. Call the getSource argument and modify the given canvas / image data.
Properties:
Type Description
Array.<DrawableImage~imageProcess>

(constant) initializer :string

The name of constructor the class, will be used to restore the object. The constructor has to be accessable via
window[initializer]
Type:
  • string
Overrides:
Implements:

Methods

canDrawPartial() → {boolean}

Can it draw only a certain part? If yes, drawContext will be called with rect, and drawable should draw only in that rect. Drawing less = better performance.
Overrides:
Returns:
Type
boolean

drawOnContext(context, rect)

Draw on this context. If canDrawPartial is true, this can be called with rect. When it is called with rect, drawable should only draw in the specificed area.
Parameters:
Name Type Description
context CanvasRenderingContext2D
rect Rect In the context's coordinate.
Overrides:

frame() → {Rect}

Return the frame, which is the actually area this drawable draws on (including things like shadow). Subclass should override if needed.
Inherited From:
Returns:
Type
Rect

(inner) getSource() → {Canvas|ImageData}

Parameters:
Type Description
string "canvas" or "imageData"
Returns:
Type
Canvas | ImageData

(inner) imageProcess(getSource, options)

Parameters:
Name Type Description
getSource DrawableImage~getSource
options Object.<string, any> drawable image's option