Burns the annotation objects in Container to the destination context and destination rectangle.
public void BurnToRect(
Leadtools.LeadRectD destinationRect
)
Public Sub BurnToRect( _
ByVal destinationRect As Leadtools.LeadRectD _
)
public void BurnToRect(
Leadtools.LeadRectD destinationRect
)
-(void) burnToRect:(LeadRectD) destinationRect;
public void burnToRect(LeadRectD destinationRect)
function Leadtools.Annotations.Core.AnnRenderingEngine.BurnToRect(
destinationRect
)
destinationRect
The destination rectangle in container coordinates.
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.
This example will create a container, adds a couple of objects and then burn it to a canvas
using Leadtools.Annotations.Automation;
using Leadtools.Annotations.Core;
using Leadtools.Annotations.Rendering;
using Leadtools.Codecs;
using Leadtools.Annotations.WinForms;
public void AnnRenderingEngine_BurnToRect(/*RasterImage image*/)
{
// 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);
// 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 = LeadRectD.Create(0, 0, 200, 200);
rc = mapper.RectToContainerCoordinates(rc);
// Burn the annotations on this image
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);
// Burn it
renderingEngine.BurnToRect(rc);
}
Leadtools.Drawing.RasterImagePainter.DeleteLeadDC(hDC);
}
// Invalidate
_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_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 AnnWinRTRenderingEngine(container, _viewer.InteractiveModeCanvas);
// Burn it
renderingEngine.BurnToRect(rc);
// Invalidate
_automation.Invalidate(LeadRectDHelper.Empty);
}
Products |
Support |
Feedback: BurnToRect Method - Leadtools.Annotations.Core |
Introduction |
Help Version 19.0.2017.3.22
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.