Class Point
Represents an ordered pair of double x- and y-coordinates that defines a point in a two-dimensional plane.
Inheritance
Namespace: IronSoftware.Drawing
Assembly: IronSoftware.Drawing.Common.dll
Syntax
public class Point : Object
Pixel-precise coordinate work in C# gets a cross-library anchor through Point, a lightweight record that holds an integer X and Y pair representing a location in a two-dimensional plane. Because IronDrawing targets cross-platform compatibility, Point ships with a full set of implicit conversion operators so the same value flows into SkiaSharp (SKPointI), System.Drawing (System.Drawing.Point), and other coordinate types without explicit casting.
Construct a value with new Point(int x, int y). The two settable properties, X and Y, expose the horizontal and vertical components directly and can be reassigned after construction. When you need to shift a point relative to its current position, Offset(int dx, int dy) adds the deltas in place, which is cleaner than constructing a replacement. Equals and GetHashCode are overridden so Point values compare by coordinate rather than by reference, making them safe to use in dictionaries and hash sets.
The implicit operators are the feature that earns Point its role as a hub type. Assignments and method arguments that expect a System.Drawing.Point, a SKPointI, or one of the other supported coordinate types accept a Point directly, and the reverse conversions are also defined. This means code that mixes IronDrawing with SkiaSharp or with System.Drawing does not need adapter layers or manual unpacking.
A common pattern is to read coordinates from a cropping rectangle or a detected region, adjust them with Offset, and then pass the result straight to a rendering or layout API that expects a different point type:
using IronSoftware.Drawing;
var origin = new Point(120, 80);
origin.Offset(10, -5);
// Implicit conversion: no cast needed when the target API expects SKPointI
SKPointI skPoint = origin;
Console.WriteLine($"SKPointI: {skPoint.X}, {skPoint.Y}");The IronDrawing get-started guide covers installation and setup. The coordinate types overview explains how Point, Rectangle, and Color relate to each other. For practical usage patterns, the cross-library interop examples show implicit conversions in action.
Constructors
Point(Int32, Int32)
Initializes a new instance of the Point struct with the specified coordinates.
Declaration
public Point(int x, int y)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | x | |
| System.Int32 | y |
Properties
X
Gets or sets the x-coordinate of this Point.
Declaration
public int X { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Y
Gets or sets the y-coordinate of this Point.
Declaration
public int Y { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The point to test for equality. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if other has the same coordinates as this point instance. |
GetHashCode()
Hashing integer based on image raw binary data.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | Int |
Offset(Int32, Int32)
Translates this Point by the specified amount.
Declaration
public void Offset(int dx, int dy)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | dx | The amount to offset the x-coordinate. |
| System.Int32 | dy | The amount to offset the y-coordinate. |
Operators
Implicit(Point to Point)
Implicitly casts Point objects to Microsoft.Maui.Graphics.Point
Declaration
public static implicit operator Point(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | Point will automatically be casted to Microsoft.Maui.Graphics.Point |
Returns
| Type | Description |
|---|---|
| Microsoft.Maui.Graphics.Point |
Implicit(Point to Point)
Implicitly casts Point objects to SixLabors.ImageSharp.Point
Declaration
public static implicit operator Point(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | Point will automatically be casted to SixLabors.ImageSharp.Point |
Returns
| Type | Description |
|---|---|
| SixLabors.ImageSharp.Point |
Implicit(Point to SKPointI)
Implicitly casts Point objects to SkiaSharp.SKPointI
Declaration
public static implicit operator SKPointI(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | Point will automatically be casted to SkiaSharp.SKPointI |
Returns
| Type | Description |
|---|---|
| SkiaSharp.SKPointI |
Implicit(Point to Point)
Implicitly casts Point objects to System.Drawing.Point
Declaration
public static implicit operator Point(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | Point will automatically be casted to System.Drawing.Point |
Returns
| Type | Description |
|---|---|
| System.Drawing.Point |
Implicit(Point to Point)
Implicitly casts Microsoft.Maui.Graphics.Point objects to Point.
Declaration
public static implicit operator Point(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.Maui.Graphics.Point | point | Microsoft.Maui.Graphics.Point will automatically be casted to Point |
Returns
| Type | Description |
|---|---|
| Point |
Implicit(Point to Point)
Implicitly casts SixLabors.ImageSharp.Point objects to Point
Declaration
public static implicit operator Point(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| SixLabors.ImageSharp.Point | point | System.Drawing.Point will automatically be casted to Point |
Returns
| Type | Description |
|---|---|
| Point |
Implicit(SKPointI to Point)
Implicitly casts SkiaSharp.SKPointI objects to Point.
Declaration
public static implicit operator Point(SKPointI point)
Parameters
| Type | Name | Description |
|---|---|---|
| SkiaSharp.SKPointI | point | SkiaSharp.SKPointI will automatically be casted to Point |
Returns
| Type | Description |
|---|---|
| Point |
Implicit(Point to Point)
Implicitly casts System.Drawing.Point objects to Point.
Declaration
public static implicit operator Point(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Point | point | System.Drawing.Point will automatically be casted to Point |
Returns
| Type | Description |
|---|---|
| Point |