Leadtools.Windows.Annotations Namespace > AnnContainer Class > Realize Method : Realize(RasterImage) Method |
public virtual RasterImage Realize( RasterImage image )
'Declaration Public Overloads Overridable Function Realize( _ ByVal image As RasterImage _ ) As RasterImage
'Usage Dim instance As AnnContainer Dim image As RasterImage Dim value As RasterImage value = instance.Realize(image)
public: virtual RasterImage^ Realize( RasterImage^ image )
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).
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
using Leadtools; using Leadtools.Windows.Annotations; using Leadtools.Windows.Controls; using Leadtools.Codecs; 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); } } } }