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
, andMicrosoft.Maui.Graphics
. The difference between Point and PointF class 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.
In the code snippet above, System.Double
values are used to set the x and y properties of the Point object, while for the PointF
object, System.Single
values (float values) are used 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
.