Draws the container on the surface of the specified raster image.
public virtual RasterImage Realize(
RasterImage image
)
Public Overloads Overridable Function Realize( _
ByVal image As Leadtools.RasterImage _
) As Leadtools.RasterImage
public:
virtual Leadtools.RasterImage^ Realize(
Leadtools.RasterImage^ image
)
image
The Leadtools.RasterImage object on which to draw this AnnContainer. Must not be null (Nothing in VB).
A Leadtools.RasterImage object that contains the combination of the original image in image overlayed with the annotation objects of this container. This is a new image with the same size as image. It is the user's responsibility to dispose this image when no longer used.
To create a Leadtools.RasterImage representation of an AnnContainer, you must first create a Leadtools.RasterImage object, fill it with the required background color and then call Realize.
Note that this method does not perform any scaling or offsetting. The container will be rendered at location 0,0 and with size equals to the container current size (ActualWidth and ActualHeight). Hence, typically, image will have the same size as the container. Otherwise, if the size of image is smaller than the container size, the returned raster image will be clipped. You can however use the image returned from this method as the source for a combine operation with another raster image to offset or scale the representation of the objects.
To render this container on the surface of a System.Windows.Media.Imaging.BitmapSource, use Realize(bitmapsource).
This example will show how to render the container into an image and save it as PNG to disk.
using Leadtools;
using Leadtools.Windows.Annotations;
using Leadtools.Windows.Controls;
using Leadtools.Codecs;
//using Leadtools.Demos;
//using Leadtools.Help;
private void RealizeRasterImageExample(AnnContainer container)
{
// Create a raster image with the same size as the container, this is the background of the realize operation
using (RasterImage backImage = RasterImage.Create(
(int)container.ActualWidth,
(int)container.ActualHeight,
32,
96,
RasterColor.FromKnownColor(RasterKnownColor.White)))
{
// Render the container on the image
using (RasterImage containerRender = container.Realize(backImage))
{
// Save it to disk
using (RasterCodecs codecs = new RasterCodecs())
{
codecs.Save(
containerRender,
@"C:\Users\Public\Documents\LEADTOOLS Images\ContainerRender.png",
RasterImageFormat.Png,
32);
}
}
}
}
Imports Leadtools.Windows.Annotations
Imports Leadtools.Windows.Controls
Imports Leadtools
Imports Leadtools.Codecs
Private Sub RealizeRasterImageExample(ByVal container As AnnContainer)
' Create a raster image with the same size as the container, this is the background of the realize operation
Using backImage As RasterImage = RasterImage.Create(
CType(container.ActualWidth, Integer),
CType(container.ActualHeight, Integer),
32,
96,
RasterColor.FromKnownColor(RasterKnownColor.White))
' Render the container on the image
Using containerRender As RasterImage = container.Realize(backImage)
' Save it to disk
Using codecs As New RasterCodecs()
codecs.Save(
containerRender,
"C:\Users\Public\Documents\LEADTOOLS Images\ContainerRender.png",
RasterImageFormat.Png,
32)
End Using
End Using
End Using
End Sub
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