canvasLayer
Layer API:
#.canvasLayer( contextObject, height, width);
CanvasLayer API return rendering instance of Canvas-2D context. It accepts multiple parameters as specified below.
Example:
contextAttrObject - Canvas context attributes, which will be passed to the getContext method.
height: height of the canvas,
width: width of the canvas
Layer Methods:
Layer.setLayerId( String ) - For setting ID attribute to the Layer Dom element.
Layer.setClear( function ) - To set clear callback method. Accepts function as an input, which gets invoked on every refresh Cycle before render begins. The clear function gets context as an argument.
Layer.SetPixelRation( Int ); - To set device Pixel ratio.
Layer.SetSize( width, height ); - Optional - To set the Size of the canvas layer. If not, the parent container size will be inherited by the layer.
Layer.getPixels( x, y, width, height ); - To fetch pixels from the specified rectangle area of the canvas layer. It returns the ImageData object.
Layer.putPixels( imageData, x, y ); - To paint pixels to the canvas. It accepts ImageData along with position x, y as an argument.
Layer.clear( ); - To clear the canvas. It can be invoked in some special cases to clear the canvas.
Layer.setContext( prop, value ); - To set properties to the canvas context.
Layer.update( ); - API to manually trigger the Layer update. In the case of the default behavior, all the changes from VDOM will be applied to the DOM as a part of the refresh cycle.
Layer.destroy( ); - To remove layer instance. It removes the DOM element along with the vDOM. and Also unbinds all the event listeners is any.
Last updated