Error processing SSI file
(Leadtools.Annotations.Core)

Show in webframe

BurnToRectWithDpi Method






The destination rectangle in container coordinates.
Horizontal source (image) DPI.
Vertical source (image) DPI.
Horizontal target (screen) DPI.
Vertical target (screen) DPI.
Burns the annotation objects in Container to the destination context and destination rectangle at the specified resolution.
Syntax
'Declaration
 
Public Sub BurnToRectWithDpi( _
   ByVal destinationRect As LeadRectD, _
   ByVal sourceDpiX As Double, _
   ByVal sourceDpiY As Double, _
   ByVal targetDpiX As Double, _
   ByVal targetDpiY As Double _
) 
-(void) burnToRectWithDpi:(LeadRectD) destinationRect
               sourceDpiX:(double)sourceDpiX
               sourceDpiY:(double)sourceDpiY
               targetDpiX:(double)targetDpiX
               targetDpiY:(double)targetDpiY;
            
public void burnToRectWithDpi(
   LeadRectD destinationRect,
   double sourceDpiX,
   double sourceDpiY,
   double targetDpiX,
   double targetDpiY
)
            
 function Leadtools.Annotations.Core.AnnRenderingEngine.BurnToRectWithDpi( 
   destinationRect ,
   sourceDpiX ,
   sourceDpiY ,
   targetDpiX ,
   targetDpiY 
)

Parameters

destinationRect
The destination rectangle in container coordinates.
sourceDpiX
Horizontal source (image) DPI.
sourceDpiY
Vertical source (image) DPI.
targetDpiX
Horizontal target (screen) DPI.
targetDpiY
Vertical target (screen) 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

This example will create a container, add a couple of objects and then burn it into the viewer

Copy Code  
using Leadtools.Annotations.Automation;
using Leadtools.Annotations.Core;
using Leadtools.Annotations.Rendering;
using Leadtools.Codecs;
using Leadtools.Annotations.WinForms;

      
public void AnnRenderingEngine_BurnToRectWithDpi(/*RasterImage image*/)
{
   // _viewer is ImageViewer _automation is working on
   // Get the container
   AnnContainer container = _automation.Container;
   RasterImage image = _viewer.Image;

   double inch = 720.0;

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

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

   IAnnAutomationControl annAutomationControl = _automation.AutomationControl;

   RasterColor[] colors = image.GetPalette();
   IntPtr hDC = Leadtools.Drawing.RasterImagePainter.CreateLeadDC(image);
   if (hDC != null)
   {
      using (Graphics g = Graphics.FromHdc(hDC))
      {
         // Create a new rendering engine for this container and context
         AnnWinFormsRenderingEngine renderingEngine = new AnnWinFormsRenderingEngine(container, g);

         // Set the resolution
         double dpiX = g.DpiX;
         double dpiY = g.DpiY;
         double xRes = annAutomationControl.AutomationDpiX;
         double yRes = annAutomationControl.AutomationDpiY;

         // Burn it
         renderingEngine.BurnToRectWithDpi(LeadRectD.Empty, dpiX, dpiY, xRes, yRes);
      }

      Leadtools.Drawing.RasterImagePainter.DeleteLeadDC(hDC);
   }

   // Delete the objects we added
   _automation.SelectObjects(container.Children);
   _automation.DeleteSelectedObjects();

   // Invalidate to see the burned objects
   _automation.Invalidate(LeadRectD.Empty);
}
using Leadtools.Converters;
using Leadtools.Annotations.Automation;
using Leadtools.Controls;
using Leadtools.Annotations.Core;
using Leadtools.Annotations.Rendering;
using Leadtools.Codecs;

      
public void AnnRenderingEngine_BurnToRectWithDpi()
{
   // _viewer is ImageViewer _automation is working on
   // 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);

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

   // Set the resolution
   double dpiX = _viewer.ScreenDpiX;
   double dpiY = _viewer.ScreenDpiY;
   double xRes = _viewer.ImageDpiX;
   double yRes = _viewer.ImageDpiY;

   // Burn it
   renderingEngine.BurnToRectWithDpi(LeadRectDHelper.Empty, dpiX, dpiY, xRes, yRes);

   // Delete the objects we added
   _automation.SelectObjects(container.Children);
   _automation.DeleteSelectedObjects();

   // Invalidate to see the burned objects
   _viewer.Invalidate();
}
Requirements

Target Platforms

See Also

Reference

AnnRenderingEngine Class
AnnRenderingEngine Members

Error processing SSI file
   Leadtools.Annotations.Core requires a Document or Medical toolkit license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features