Draws the container on the surface of the specified Leadtools.RasterImage object.
public virtual void Draw(Leadtools.RasterImage image)
Public Overloads Overridable Sub Draw( _ByVal image As Leadtools.RasterImage _)
public:virtual void Draw(Leadtools.RasterImage^ image)
image
The Leadtools.RasterImage object on which to draw this AnnContainer.
All visible objects in this container will be drawn into the specified image.
The container objects might be scaled to fit into the image dimension. This method is the equivalent of calling Draw(Graphics, Rectangle) with the rectangle values set to 0, 0, image.ImageWidth, image.ImageHeight/>.
Internally this method will call RasterImage.CreateLeadDC, so the image must satisfy the requirement for that method.
This example will create a container, adds a few annotations objects then burn them on the surface of a Leadtools.RasterImage object.
using Leadtools;using Leadtools.Annotations;using Leadtools.Codecs;using Leadtools.WinForms;private void ContainerDrawRasterImageExample(){// Load the imageRasterCodecs codecs = new RasterCodecs();RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif"));// Create and set up the containerAnnContainer container = new AnnContainer();container.Bounds = new AnnRectangle(0, 0, image.ImageWidth, image.ImageHeight);container.UnitConverter = new AnnUnitConverter(image.XResolution, image.YResolution);// add a few objects to the containerAnnLineObject line = new AnnLineObject();line.Name = "Line1";line.Pen = new AnnPen(Color.Red, new AnnLength(1, AnnUnit.Pixel));line.StartPoint = new AnnPoint(10, 10, AnnUnit.Pixel);line.EndPoint = new AnnPoint(container.Bounds.Right - 10, container.Bounds.Bottom - 10, AnnUnit.Pixel);container.Objects.Add(line);AnnRectangleObject rect = new AnnRectangleObject();rect.Name = "Rectangle1";rect.Pen = new AnnPen(Color.Blue, new AnnLength(1, AnnUnit.Pixel));rect.Brush = new AnnSolidBrush(Color.White);rect.Bounds = new AnnRectangle(25, 25, 50, 50, AnnUnit.Pixel);container.Objects.Add(rect);// Now paint the annotation onto the image surfacecontainer.Draw(image);// Save the image to the output filecodecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Ocr1_CotainerDraw.tif"), RasterImageFormat.Tif, image.BitsPerPixel);// Clean upcontainer.Dispose();image.Dispose();codecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.AnnotationsImports Leadtools.CodecsImports Leadtools.WinFormsPrivate Sub ContainerDrawRasterImageExample()' Load the imageDim codecs As New RasterCodecs()Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif"))' Create and set up the containerDim container As New AnnContainer()container.Bounds = New AnnRectangle(0, 0, image.ImageWidth, image.ImageHeight)container.UnitConverter = New AnnUnitConverter(image.XResolution, image.YResolution)' add a few objects to the containerDim line As New AnnLineObject()line.Name = "Line1"line.Pen = New AnnPen(Color.Red, New AnnLength(1, AnnUnit.Pixel))line.StartPoint = New AnnPoint(10, 10, AnnUnit.Pixel)line.EndPoint = New AnnPoint(container.Bounds.Right - 10, container.Bounds.Bottom - 10, AnnUnit.Pixel)container.Objects.Add(line)Dim rect As New AnnRectangleObject()rect.Name = "Rectangle1"rect.Pen = New AnnPen(Color.Blue, New AnnLength(1, AnnUnit.Pixel))rect.Brush = New AnnSolidBrush(Color.White)rect.Bounds = New AnnRectangle(25, 25, 50, 50, AnnUnit.Pixel)container.Objects.Add(rect)' Now paint the annotation onto the image surfacecontainer.Draw(image)' Save the image to the output filecodecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Ocr1_CotainerDraw.tif"), RasterImageFormat.Tif, image.BitsPerPixel)' Clean upcontainer.Dispose()image.Dispose()codecs.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
|
Products |
Support |
Feedback: Draw(RasterImage) Method - Leadtools.Annotations |
Introduction |
Help Version 19.0.2017.6.20
|

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.