LEADTOOLS JavaScript (Leadtools.Annotations.Core)
LEAD Technologies, Inc

BurnToRectWithDpi Method

Example 

The destination rectangle in container coordinates.
Horizontal source (screen) DPI.
Vertical source (screen) DPI.
Horizontal target (image) DPI.
Vertical target (image) DPI.
Burns the annotation objects in Container to the destination context and destination rectangle at the specified resolution.
Syntax
 function Leadtools.Annotations.Core.AnnRenderingEngine.burnToRectWithDpi( 
   destinationRect ,
   sourceDpiX ,
   sourceDpiY ,
   targetDpiX ,
   targetDpiY 
)
!MISSING Scrap '_RTJavaScript_Method_SYNTAX'!

Parameters

ParameterTypeDescription
destinationRectLeadRectDThe destination rectangle in container coordinates.
sourceDpiXdoubleHorizontal source (screen) DPI.
sourceDpiYdoubleVertical source (screen) DPI.
targetDpiXdoubleHorizontal target (image) DPI.
targetDpiYdoubleVertical target (image) DPI.
Remarks

All visible objects in this container will be drawn into the current context.

This method uses the resolution (DPI) values specified and not the values stored in the container. Use this method when burning the container objects into any context.

To burn a container into the context of the image being automated, use Burn.

Example
example: function SiteLibrary_DefaultPage$example(viewer) {
   // viewer is ImageViewer this._automation is working on

   // Get the container
   var container = this._automation.get_container();

   var inch = 720.0;

   // Add a red line object, from 1in 1in to 2in 2in
   var lineObj = new Leadtools.Annotations.Core.AnnPolylineObject();
   lineObj.get_points().add(Leadtools.LeadPointD.create(1 * inch, 1 * inch));
   lineObj.get_points().add(Leadtools.LeadPointD.create(2 * inch, 2 * inch));
   lineObj.set_stroke(Leadtools.Annotations.Core.AnnStroke.create(Leadtools.Annotations.Core.AnnSolidColorBrush.create("red"), Leadtools.LeadLengthD.create(1)));
   container.get_children().add(lineObj);

   // Add a blue on yellow rectangle from 3in 3in to 4in 4in
   var rectObj = new Leadtools.Annotations.Core.AnnRectangleObject();
   rectObj.set_rect(Leadtools.LeadRectD.create(3 * inch, 3 * inch, 1 * inch, 1 * inch));
   rectObj.set_stroke(Leadtools.Annotations.Core.AnnStroke.create(Leadtools.Annotations.Core.AnnSolidColorBrush.create("blue"), Leadtools.LeadLengthD.create(1)));
   rectObj.set_fill(Leadtools.Annotations.Core.AnnSolidColorBrush.create("yellow"));
   container.get_children().add(rectObj);

   // To burn the annotations, we need a canvas context and a new rendering engine

   // Get the background canvas of the viewer
   var canvas = viewer.get_backCanvas();
   var context = canvas.getContext("2d");

   // Create a new rendering engine for this container and context
   var renderingEngine = new Leadtools.Annotations.Rendering.AnnHtml5RenderingEngine(container, context, false);

   // Set the resolution
   var dpiX = viewer.get_screenDpiX();
   var dpiY = viewer.get_screenDpiY();
   var xRes = viewer.get_imageDpiX();
   var yRes = viewer.get_imageDpiY();

   // Burn it
   renderingEngine.burnToRectWithDpi(Leadtools.LeadRectD.get_empty(), dpiX, dpiY, xRes, yRes);

   // Delete the objects we added
   this._automation.selectObjects(container.get_children());
   this._automation.deleteSelectedObjects();

   // Invalidate to see the burned objects
   viewer.invalidate();
},
See Also

Reference

AnnRenderingEngine Object
AnnRenderingEngine Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.