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

BurnToRect Method

Example 

The destination rectangle in container coordinates.
Burns the annotation objects in Container to the destination context and destination rectangle. WinRT support
Syntax
public void BurnToRect( 
   LeadRectD destinationRect
)
 function Leadtools.Annotations.Core.AnnRenderingEngine.BurnToRect( 
   destinationRect 
)

Parameters

destinationRect
The destination rectangle in container coordinates.
Remarks

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

This method uses the resolution (DPI) values stored in the container. Use this method when burning the container objects into the context of the image currently being used in the automation.

To burn a container into a context while specifying new resolution (DPI) values, use BurnToRectWithDpi.

Example
 
[TestMethod]
public void AnnRenderingEngine_BurnToRect()
{
   // Get the container
   AnnContainer container = _automation.Container;
   double inch = 720.0;

   // Add a red line object, from 1in 1in to 2in 2in
   AnnPolylineObject lineObj = new AnnPolylineObject();
   lineObj.Points.Add(LeadPointDHelper.Create(1 * inch, 1 * inch));
   lineObj.Points.Add(LeadPointDHelper.Create(2 * inch, 2 * inch));
   lineObj.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Red"), LeadLengthDHelper.Create(1));
   container.Children.Add(lineObj);

   // Add a blue on yellow rectangle from 3in 3in to 4in 4in
   AnnRectangleObject rectObj = new AnnRectangleObject();
   rectObj.Rect = LeadRectDHelper.Create(3 * inch, 3 * inch, 1 * inch, 1 * inch);
   rectObj.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), LeadLengthDHelper.Create(1));
   rectObj.Fill = AnnSolidColorBrush.Create("Yellow");
   container.Children.Add(rectObj);

   // Get the destination rectangle in container coordinates
   // The canvas DPI is 96, and the units are 1/720 of an inch
   // So, sizeInUnits = (sizeInPixels / dpi) = size in inches * 720 = size in container units
   // Or, we can use the annotations mapper, like this
   AnnContainerMapper mapper = AnnContainerMapper.CreateDefault();
   LeadRectD rc = LeadRectDHelper.Create(0, 0, 200, 200);
   rc = mapper.RectToContainerCoordinates(rc);

   // Burn the annotations on this canvas

   // Create a new rendering engine for this container and context
   AnnRenderingEngine renderingEngine = new AnnMetroRenderingEngine(container, _viewer.InteractiveModeCanvas);

   // Burn it
   renderingEngine.BurnToRect(rc);

   // Invalidate
   _automation.Invalidate(LeadRectDHelper.Empty);
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

AnnRenderingEngine Class
AnnRenderingEngine Members

 

 


Products | Support | Contact Us | Copyright Notices

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