public void BurnToRectWithDpi( LeadRectD destinationRect, double sourceDpiX, double sourceDpiY, double targetDpiX, double targetDpiY )
function Leadtools.Annotations.Core.AnnRenderingEngine.BurnToRectWithDpi( destinationRect , sourceDpiX , sourceDpiY , targetDpiX , targetDpiY )
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.
[TestMethod] 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 AnnMetroRenderingEngine renderingEngine = new AnnMetroRenderingEngine(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(); }
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