Creates or updates a LEADTOOLS image region by adding the specified Windows region handle.
public static void AddRegionToRegion(Leadtools.RasterImage image,Leadtools.RasterRegionXForm xform,IntPtr region,Leadtools.RasterRegionCombineMode combineMode)
Public Overloads Shared Sub AddRegionToRegion( _ByVal image As Leadtools.RasterImage, _ByVal xform As Leadtools.RasterRegionXForm, _ByVal region As IntPtr, _ByVal combineMode As Leadtools.RasterRegionCombineMode _)
public:static void AddRegionToRegion(Leadtools.RasterImage^ image,Leadtools.RasterRegionXForm^ xform,IntPtr region,Leadtools.RasterRegionCombineMode combineMode)
image
The source image.
xform
Leadtools.RasterRegionXForm object that LEADTOOLS uses to translate between display coordinates and image coordinates. If you specify null (Nothing in VB) in this parameter, the scalar fields default to 1, the offsets default to 0, and the view perspective defaults to the image view perspective.
region
The Windows region handle to add.
combineMode
The action to take regarding the existing image region, if one is defined.
To update an existing region, you specify how the new region is to be combined with the existing one using the combineMode parameter. For more information, refer to Leadtools.RasterRegionCombineMode.
For more information, refer to Creating a Region.
For more information, refer to Saving A Region.
For more information, refer to Working with the Existing Region.
For more information refer to RasterImage and GDI/GDI+.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.DrawingImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.Color<TestMethod()> _Public Sub AddRegionToRegionGdi_Example()Dim codecs As New RasterCodecs()Dim srcFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp"Dim destFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "Image1_AddRegionToRegion.bmp"' Load the imageDim image As RasterImage = codecs.Load(srcFileName)' Create a GDI+ regionDim region As RegionUsing path As New GraphicsPath()path.AddRectangle(New Rectangle(100, 100, 200, 200))path.AddEllipse(New Rectangle(150, 150, 200, 200))region = New Region(path)End Using' Get the Windows GDI handle for this regionDim hrgn As IntPtrUsing btmp As New Bitmap(1, 1)Using graphics As Graphics = graphics.FromImage(btmp)hrgn = region.GetHrgn(graphics)End UsingEnd Using' Add this region to the raster imageRasterRegionConverter.AddRegionToRegion(image, Nothing, hrgn, RasterRegionCombineMode.Set)region.ReleaseHrgn(hrgn)region.Dispose()' Draw something on the imageDim command As New InvertCommand()command.Run(image)' Save the imagecodecs.Save(image, destFileName, RasterImageFormat.Bmp, 24)image.Dispose()codecs.Dispose()End Sub
using Leadtools;using Leadtools.Codecs;using Leadtools.Drawing;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;public void AddRegionToRegionGdi_Example(){RasterCodecs codecs = new RasterCodecs();string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1_AddRegionToRegion.bmp");// Load the imageRasterImage image = codecs.Load(srcFileName);// Create a GDI+ regionRegion region;using(GraphicsPath path = new GraphicsPath()){path.AddRectangle(new Rectangle(100, 100, 200, 200));path.AddEllipse(new Rectangle(150, 150, 200, 200));region = new Region(path);}// Get the Windows GDI handle for this regionIntPtr hrgn;using(Bitmap btmp = new Bitmap(1, 1)){using(Graphics graphics = Graphics.FromImage(btmp)){hrgn = region.GetHrgn(graphics);}}// Add this region to the raster imageRasterRegionConverter.AddRegionToRegion(image, null, hrgn, RasterRegionCombineMode.Set);region.ReleaseHrgn(hrgn);region.Dispose();// Draw something on the imageInvertCommand command = new InvertCommand();command.Run(image);// Save the imagecodecs.Save(image, destFileName, RasterImageFormat.Bmp, 24);image.Dispose();codecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: AddRegionToRegion(RasterImage,RasterRegionXForm,IntPtr,RasterRegionCombineMode) Method - Leadtools.Drawing |
Introduction |
Help Version 19.0.2017.3.21
|

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.