Point & PointF
IronDrawing introduces two new classes: IronSoftware.Drawing.Point
and IronSoftware.Drawing.PointF
. These classes are used to represent an ordered pair of double-x and double-y coordinates, defining a point in a two-dimensional plane, which is useful for image processing. Similar classes are present in other image libraries such as System.Drawing
, SixLabors.ImageSharp
, SkiaSharp
, and Microsoft.Maui.Graphics
. The difference between the Point
and PointF
classes lies in the type of value accepted as a parameter in the constructor of the Point
and PointF
objects.
Instantiating a new Point
or PointF
object is straightforward, requiring only two properties to be set: X and Y values that make up the coordinates of the point.
Point
is instantiated usingSystem.Double
values to set thex
andy
properties of thePoint
object.PointF
is instantiated usingSystem.Single
values (float values) for the same purpose.
Both IronSoftware.Drawing.Point
and IronSoftware.Drawing.PointF
classes share the same functionality and methods. Using System.Double
is often preferred due to its higher accuracy, accepting larger decimal point values, and representing double precision as a 64-bit floating-point type. On the other hand, System.Single
is a 32-bit floating-point type, providing lower precision compared to System.Double
. As a result, it is recommended to use IronSoftware.Drawing.Point
rather than IronSoftware.Drawing.PointF
.