Search Results for

    Show / Hide Table of Contents

    Class PointF

    Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional plane.

    Inheritance
    System.Object
    PointF
    Namespace: IronSoftware.Drawing
    Assembly: IronSoftware.Drawing.Common.dll
    Syntax
    public class PointF : Object

    Precise sub-pixel positioning in cross-platform .NET graphics relies on PointF, a lightweight coordinate record that stores an ordered pair of single-precision floating-point values as X and Y. Wherever IronDrawing needs to express a location on a two-dimensional plane, such as a text anchor, a crop origin, or a shape vertex, PointF is the common currency that travels between rendering engines without losing fractional precision.

    Construct a point with new PointF(float x, float y) and read or update its position through the X and Y properties, both of which are mutable. To shift a point relative to its current location, call Offset(float dx, float dy), which adds the supplied deltas directly to X and Y in place. This avoids allocating a replacement instance when only a translation is needed, which is common in layout loops that nudge elements by a fixed margin.

    PointF integrates smoothly with SkiaSharp through a set of implicit conversion operators. An SKPoint converts to PointF automatically, and a PointF converts back to SKPoint, so code that mixes IronDrawing APIs with direct SkiaSharp calls requires no explicit casts. Additional implicit operators cover the System.Drawing.PointF type and related platform point types, meaning a value obtained from one graphics subsystem passes directly into another. Equals and GetHashCode are overridden so that PointF instances compare by coordinate value rather than reference, making them safe to use as dictionary keys or in LINQ distinct operations.

    Because PointF derives from Object and carries no unmanaged resources, no disposal step is required. It is a plain, allocatable value-holder that fits naturally into collections, tuples, and return types throughout the IronDrawing surface.

    using IronSoftware.Drawing;
    
    // Build a point, shift it, then use it as an SKPoint implicitly.
    var origin = new PointF(12.5f, 34.75f);
    origin.Offset(5f, -10f);          // origin is now (17.5, 24.75)
    
    SkiaSharp.SKPoint skPt = origin;  // implicit operator, no cast needed
    Console.WriteLine($"SKPoint: {skPt.X}, {skPt.Y}");

    Explore further with the IronDrawing getting-started guide, the coordinate and geometry how-to, the AnyBitmap drawing examples, and the IronDrawing API documentation hub.

    Constructors

    PointF(Single, Single)

    Initializes a new instance of the PointF struct with the specified coordinates.

    Declaration
    public PointF(float x, float y)
    Parameters
    Type Name Description
    System.Single x
    System.Single y

    Properties

    X

    Gets or sets the x-coordinate of this PointF.

    Declaration
    public float X { get; set; }
    Property Value
    Type Description
    System.Single

    Y

    Gets or sets the y-coordinate of this PointF.

    Declaration
    public float Y { get; set; }
    Property Value
    Type Description
    System.Single

    Methods

    Equals(Object)

    Specifies whether this PointF instance contains the same coordinates as another PointF.

    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(Single, Single)

    Translates this PointF by the specified amount.

    Declaration
    public void Offset(float dx, float dy)
    Parameters
    Type Name Description
    System.Single dx

    The amount to offset the x-coordinate.

    System.Single dy

    The amount to offset the y-coordinate.

    Operators

    Implicit(PointF to PointF)

    Implicitly casts PointF objects to Microsoft.Maui.Graphics.Point

    Declaration
    public static implicit operator PointF(PointF point)
    Parameters
    Type Name Description
    PointF point

    PointF will automatically be casted to Microsoft.Maui.Graphics.Point

    Returns
    Type Description
    Microsoft.Maui.Graphics.PointF

    Implicit(PointF to PointF)

    Implicitly casts a PointF object to SixLabors.ImageSharp.PointF

    Declaration
    public static implicit operator PointF(PointF point)
    Parameters
    Type Name Description
    PointF point

    PointF will automatically be casted to SixLabors.ImageSharp.PointF

    Returns
    Type Description
    SixLabors.ImageSharp.PointF

    Implicit(PointF to SKPoint)

    Implicitly casts PointF objects to SkiaSharp.SKPoint

    Declaration
    public static implicit operator SKPoint(PointF point)
    Parameters
    Type Name Description
    PointF point

    PointF will automatically be casted to SkiaSharp.SKPoint

    Returns
    Type Description
    SkiaSharp.SKPoint

    Implicit(PointF to PointF)

    Implicitly casts Microsoft.Maui.Graphics.Point objects to PointF

    Declaration
    public static implicit operator PointF(PointF point)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.PointF point

    Microsoft.Maui.Graphics.Point will automatically be casted to PointF

    Returns
    Type Description
    PointF

    Implicit(PointF to PointF)

    Implicitly casts SixLabors.ImageSharp.PointF objects to PointF

    Declaration
    public static implicit operator PointF(PointF point)
    Parameters
    Type Name Description
    SixLabors.ImageSharp.PointF point

    SixLabors.ImageSharp.PointF will automatically be casted to PointF

    Returns
    Type Description
    PointF

    Implicit(SKPoint to PointF)

    Implicitly casts SkiaSharp.SKPoint objects to PointF

    Declaration
    public static implicit operator PointF(SKPoint point)
    Parameters
    Type Name Description
    SkiaSharp.SKPoint point

    SkiaSharp.SKPoint will automatically be casted to PointF

    Returns
    Type Description
    PointF
    ☀
    ☾
    Downloads
    • Download with Nuget
    In This Article
    Back to top
    Install with Nuget
    IronDrawing_for_dotnet_log2o
    Blue key in circleGet started for FREE
    No credit card required
    Test in a live environment

    Test in production without watermarks.
    Works wherever you need it to.

    Fully-functional product

    Get 30 days of fully functional product.
    Have it up and running in minutes.

    24/5 technical support

    Full access to our support engineering team during your product trial

    Grey key in circleGet started for FREE
    The trial form was submitted successfully.
    Calendar in circleBook Free Live Demo
    No contact, no card details, no commitments Book a 30-minute, personal demo.
    Here's what to expect:

    A live demo of our product and its key features

    Get project specific feature recommendations

    All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation
    Support Team Member 6 related to The C# PDF Library Support Team Member 14 related to The C# PDF Library Support Team Member 4 related to The C# PDF Library Support Team Member 2 related to The C# PDF Library
    Online 24/5
    Need help? Our sales team would be glad to help you.
    Try the Enterprise Trial
    ironpdf_for_dotnet_log2o
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    bullet_checkedNo credit card or account creation required
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    Blue key in circleNo credit card or account creation required
    Green Check in orange circle
    The trial form was submitted successfully.
    badge_greencheck_in_yellowcircle
    Thank you for starting a trial

    Please check your email for the trial license key.

    If you don’t receive an email, please start a live chat or email support@ironsoftware.com

    Install with NuGet
    View Licensing
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronDrawing