Error processing SSI file
LEADTOOLS JavaScript (Leadtools.Controls)

UpdateCanvas Method

Show in webframe
Example 
Item to update
New HTML5 Canvas Element. If this is null, then the item will be empty after this method returns.
The resolution to use of the image in dots/inch (or DPI). A value of 0,0 or Empty means use the default image resolution which is 96 pixels.
Update the HTML5 Canvas Element of an item.
Syntax
 function Leadtools.Controls.ImageViewerItems.updateCanvas( 
   item ,
   canvas ,
   resolution 
)

Parameters

ParameterTypeDescription
itemImageViewerItemItem to update
canvasCanvasElementNew HTML5 Canvas Element. If this is null, then the item will be empty after this method returns.
resolutionLeadSizeDThe resolution to use of the image in dots/inch (or DPI). A value of 0,0 or Empty means use the default image resolution which is 96 pixels.
Remarks

This method is a shortcut for updating the Canvas and Resolution properties. It is equivalent to:


              item.canvas = canvas;
              item.resolution = resolution;
            

UpdateElement is a shortcut for updating not only Canvas, but also Element and Image. Passing a valid HTML Image Element to UpdateElement sets the Image property just as UpdateImage does. Similarly, passing a valid HTML5 Canvas Element to UpdateElement sets the Canvas property just as UpdateCanvas does. The item can have a value in only one of Image, Element or Canvas. Setting one value will automatically delete the values of the others.

Example
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.fillStyle = "rgba(0, 0, 255, .5)";
context.fillRect(25, 25, 125, 125);

this._imageViewer.items.updateCanvas(this._imageViewer.activeItem, canvas, lt.LeadSizeD.create(96, 96));
See Also

Reference

ImageViewerItems Object
ImageViewerItems Members

Error processing SSI file