public class RasterCurve Public Class RasterCurve public ref class RasterCurve The RasterCurve class defines the curve to be used with the AddCurveToRegion method to draw a curve using an array of LeadPoint objects. The ToBezierPoints method is used to convert a curve to a Bezier. The RasterCurve class can define two types of curves, RasterCurveType.Standard and RasterCurveType.Bezier.
This sample creates a smooth region that goes through five points, and inverts the region.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;public void RasterCurveExample(){string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1_curveinverted.bmp");// create a new curve objectRasterCurve curve = new RasterCurve();// define the curvecurve.Points.Add(new LeadPoint(30, 30));curve.Points.Add(new LeadPoint(30, 200));curve.Points.Add(new LeadPoint(130, 130));curve.Points.Add(new LeadPoint(75, 75));curve.Points.Add(new LeadPoint(130, 30));curve.Type = RasterCurveType.Standard;curve.FillMode = LeadFillMode.Winding;curve.Tension = 0.5;curve.Close = RasterCurveClose.Close;// create an imageusing (RasterImage image = new RasterImage(RasterMemoryFlags.Conventional,250,250,24,RasterByteOrder.Bgr,RasterViewPerspective.BottomLeft,null,IntPtr.Zero,0)){Assert.IsNotNull(image);// fill the imagenew FillCommand(RasterColor.FromKnownColor(RasterKnownColor.Magenta)).Run(image);image.AddCurveToRegion(null, curve, RasterRegionCombineMode.Set);// do something with the regionnew InvertCommand().Run(image);// save the imageusing (RasterCodecs codecs = new RasterCodecs()){// save the image back to diskcodecs.Save(image, destFileName, RasterImageFormat.Bmp, 24);}}}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.ColorPublic Sub RasterCurveExample()Dim codecs As RasterCodecs = New RasterCodecs()' load an imageDim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")Dim destFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1_curveinverted.bmp")Dim image As RasterImage = codecs.Load(srcFileName)' create a new curve objectDim curve As RasterCurve = New RasterCurve()' define the curvecurve.Points.Add(New LeadPoint(30, 30))curve.Points.Add(New LeadPoint(30, 200))curve.Points.Add(New LeadPoint(130, 130))curve.Points.Add(New LeadPoint(75, 75))curve.Points.Add(New LeadPoint(130, 30))curve.Type = RasterCurveType.Standardcurve.FillMode = LeadFillMode.Windingcurve.Tension = 0.5curve.Close = RasterCurveClose.Closeimage.AddCurveToRegion(Nothing, curve, RasterRegionCombineMode.Set)' do something with the regionDim cmd As InvertCommand = New InvertCommand()cmd.Run(image)' save the image back to diskcodecs.Save(image, destFileName, RasterImageFormat.Bmp, 24)' Cleanupimage.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
