Defines a curve.
Object Model
Syntax
Visual Basic (Declaration) |
|
Public Class RasterCurve |
Visual Basic (Usage) |
Copy Code |
Dim instance As RasterCurve
|
C# |
|
public class RasterCurve |
C++/CLI |
|
public ref class RasterCurve |
Example
This sample creates a smooth region that goes through five points, and inverts the region.
Visual Basic |
Copy Code |
Public Sub RasterCurveExample() RasterCodecs.Startup() Dim codecs As RasterCodecs = New RasterCodecs()
Dim srcFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp" Dim destFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "Image1_curveinverted.bmp" Dim image As RasterImage = codecs.Load(srcFileName)
Dim curve As RasterCurve = New RasterCurve()
curve.Points.Add(New Point(30, 30)) curve.Points.Add(New Point(30, 200)) curve.Points.Add(New Point(130, 130)) curve.Points.Add(New Point(75, 75)) curve.Points.Add(New Point(130, 30))
curve.Type = RasterCurveType.Standard curve.FillMode = FillMode.Winding curve.Tension = 0.5 curve.Close = RasterCurveClose.Close
image.AddCurveToRegion(Nothing, curve, RasterRegionCombineMode.Set)
Dim cmd As InvertCommand = New InvertCommand() cmd.Run(image)
codecs.Save(image, destFileName, RasterImageFormat.Bmp, 24)
image.Dispose() RasterCodecs.Shutdown() End Sub |
C# |
Copy Code |
public void RasterCurveExample() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); // load an image string srcFileName = LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp"; string destFileName = LeadtoolsExamples.Common.ImagesPath.Path + "Image1_curveinverted.bmp"; RasterImage image = codecs.Load(srcFileName); // create a new curve object RasterCurve curve = new RasterCurve(); // define the the curve curve.Points.Add(new Point(30, 30)); curve.Points.Add(new Point(30, 200)); curve.Points.Add(new Point(130, 130)); curve.Points.Add(new Point(75, 75)); curve.Points.Add(new Point(130, 30)); curve.Type = RasterCurveType.Standard; curve.FillMode = FillMode.Winding; curve.Tension = 0.5; curve.Close = RasterCurveClose.Close; image.AddCurveToRegion(null, curve, RasterRegionCombineMode.Set); // do something with the region InvertCommand cmd = new InvertCommand(); cmd.Run(image); // save the image back to disk codecs.Save(image, destFileName, RasterImageFormat.Bmp, 24); // Cleanup image.Dispose(); RasterCodecs.Shutdown(); } |
Remarks
Inheritance Hierarchy
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also