Converts the curve points to an array of Bézier points.
public [Leadtools.LeadPoint[]](leadpoint.html) ToBezierPoints() Public Function ToBezierPoints() As Leadtools.LeadPoint() public:Leadtools.array<LeadPoint>^ ToBezierPoints();
An array of LeadPoint values that contain the Bézier points.
This method is used to convert a standard curve to an array of Bézier control points. A standard curve (RasterCurveType.Standard) is defined by the current RasterCurve. The standard curve passes through all of the points in the Points collection, and is continuous at each point. This method can be used to draw a curve by converting it to an array of Bézier points, using System.Drawing.Graphics.DrawBeziers to draw the equivalent Bezier(s).
This sample draws a smooth closed curve on a graphics that goes through five points.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using LeadtoolsExamples.Common;public void ToBezierPointsExample(){// Define the curveRasterCurve curve = new RasterCurve();curve.Points.Add(new LeadPoint(130, 130));curve.Points.Add(new LeadPoint(130, 300));curve.Points.Add(new LeadPoint(230, 230));curve.Points.Add(new LeadPoint(175, 175));curve.Points.Add(new LeadPoint(230, 130));curve.Type = RasterCurveType.Standard;curve.FillMode = LeadFillMode.Winding;curve.Tension = 0.5;curve.Close = RasterCurveClose.Close;// convert this curve into bezier pointsLeadPoint[] bezierPoints = curve.ToBezierPoints();// Draw this curve on a bitmapusing (System.Drawing.Bitmap btmp = new System.Drawing.Bitmap(400, 400)){using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(btmp)){g.FillRectangle(System.Drawing.Brushes.White, new System.Drawing.Rectangle(0, 0, 400, 400));// Convert the LeadPoint array to a Point arraySystem.Drawing.Point[] pts = new System.Drawing.Point[bezierPoints.Length];for (int i = 0; i < bezierPoints.Length; i++){pts[i] = new System.Drawing.Point(bezierPoints[i].X, bezierPoints[i].Y);}g.DrawBeziers(System.Drawing.Pens.Black, pts);}// save this image to diskstring fileName = Path.Combine(ImagesPath.Path, "ToBezierPoints.bmp");btmp.Save(fileName, System.Drawing.Imaging.ImageFormat.Bmp);}}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.ColorPublic Sub ToBezierPointsExample()' Define the curveDim curve As RasterCurve = New RasterCurve()curve.Points.Add(New LeadPoint(130, 130))curve.Points.Add(New LeadPoint(130, 300))curve.Points.Add(New LeadPoint(230, 230))curve.Points.Add(New LeadPoint(175, 175))curve.Points.Add(New LeadPoint(230, 130))curve.Type = RasterCurveType.Standardcurve.FillMode = LeadFillMode.Windingcurve.Tension = 0.5curve.Close = RasterCurveClose.Close' convert this curve into bezier pointsDim bezierPoints As LeadPoint() = curve.ToBezierPoints()' Draw this curve on a bitmapUsing btmp As New System.Drawing.Bitmap(400, 400)Using g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(btmp)g.FillRectangle(System.Drawing.Brushes.White, New System.Drawing.Rectangle(0, 0, 400, 400))' Convert the LeadPoint array to a Point arrayDim pts(bezierPoints.Length - 1) As System.Drawing.PointFor i As Integer = 0 To bezierPoints.Length - 1pts(i) = New System.Drawing.Point(bezierPoints(i).X, bezierPoints(i).Y)Nextg.DrawBeziers(System.Drawing.Pens.Black, pts)End Using' save this image to diskDim fileName As String = Path.Combine(LEAD_VARS.ImagesDir, "ToBezierPoints.bmp")btmp.Save(fileName, System.Drawing.Imaging.ImageFormat.Bmp)End UsingEnd SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
|
Products |
Support |
Feedback: ToBezierPoints Method - Leadtools |
Introduction |
Help Version 19.0.2017.6.19
|

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.