API Docs for: v2.1.0
Show:

CGSGMaskCache Class

Extends CGSGMask
Module: Animation

ALFA VERSION : to be enhanced, essentially for performance reasons.

This mask could be applied to a node to cache in memory the rendering of a canvas and its nodes.

Constructor

CGSGMaskCache

()

Methods

_eventAdapter

(
  • event
)
private

Observer method which catches key events to apply the mask.

Parameters:

_internalApply

(
  • node
)
private

Inherited from CGSGMask but overwritten in src\mask\class.mask.cache.js:57

Parameters:

_internalRemove

(
  • node
)
private

Inherited from CGSGMask but overwritten in src\mask\class.mask.cache.js:93

Parameters:

apply

(
  • node
)

Apply this mask to the given node.

Parameters:

finalize

(
  • node
  • context
)
CanvasRenderingContext2D

Inherited from CGSGMask but overwritten in src\mask\class.mask.cache.js:129

Finalize this mask by drawing the memory canvas to the saved context.

Parameters:

  • node CGSGNode

    the node

  • context CanvasRenderingContext2D

    the context returned by prepare()

Returns:

CanvasRenderingContext2D:

the context that was used to invoke prepare()

invalidate

(
  • node
)

Asks the mask to refresh the canvas cache for the given node in the next rendering. Automatically called when a node is scaled, resize or translated.

Parameters:

prepare

(
  • node
  • context
)
CanvasRenderingContext2D

Inherited from CGSGMask but overwritten in src\mask\class.mask.cache.js:102

Prepare the rendering of the node by saving the given context and returning the cache context. However, if the cache is already filled, then the function will return null in order to tell the caller to not render the node.

Parameters:

  • node CGSGNode

    the node

  • context CanvasRenderingContext2D

    the context where the node will be drawn

Returns:

CanvasRenderingContext2D:

the context to use

remove

(
  • node
)

Removes this mask from a node.

Parameters:

  • node Object

    CGSGNode the node