CanvasOffscreenBuffer
This is a utility class used to create an off-screen
canvas for image manipulation.
var CanvasOffscreenBuffer = require('paraviewweb/src/Common/Misc/CanvasOffscreenBuffer'), |
constructor(width, height)
Create a canvas and add it to the DOM as a child of the<body/>
element.
size([width, [height]]) : [ width, height ]
Return the actual canvas size if used without any argument.
If the width and height arguments are provided, this will update the canvas
width and height attributes.
// Get size |
get2DContext()
Returns the 2D context of the given canvas.
var ctx = instance.get2DContext(); |
get3DContext()
Experimental, returns the 3D WebGL context of the given canvas.
toDataURL(type=’image/png’, encoderOptions=1)
Returns a data URI containing a representation of the image in the
format specified by the type parameter (defaults to PNG). The returned image has a resolution of 96 dpi.
- type : A string indicating the image format, the default is image/png.
- encoderOptions : A number between 0 and 1 indicating image quality if the requested type is image/jpeg or image/webp.
destroy()
Free the internal resources and remove the DOM element from the tree.
Source
let offscreenCanvasCount = 0; |