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
    %s requires a valid license key for further deployment. Get Trial Below.
    ironsuite
    Blue key in circleGet Started for Free
    30 days full access • 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.
    Grey check in circleTrial key delivered
    Your key has been issued and sent to your email.
    Calendar in circleBook Free Live Demo
    No cards • no pitches • no commitments Pick a time for a quick, personalized demo
    Get the most out of your 30-day trial with:

    Live product and key features walk-through

    Project-specific recommendations

    All your questions answered

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation

    Want to deploy Iron Suite
    to a live project for FREE?

    What’s included?

    • Test in production without watermarks
    • 30 days fully functional product
    • 24/5 technical support during trial
    ironpdf Logo
    ironword Logo
    ironxl Logo
    ironppt Logo
    ironocr Logo
    ironbarcode Logo
    ironqr Logo
    ironprint Logo
    ironzip Logo
    ironwebscraper Logo
    Iron Software sales team
    Online 24/5
    Have Enterprise licensing requirements?
    Request Iron Suite Enterprise trial
    Key in blue circle

    Get your free 30-day Trial Key instantly

    Your trial license will be sent to your email address

    No limitations. 100% unlocked. No credit card.

    bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
    Or
    Key in blue circle

    Complete Your Trial Key Signup

    Tell us a little more about yourself.

    Key in blue circleNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
    Key in blue circle

    Your license key has been delivered to your inbox

    Can't find it? Check your spam folder.

    What’s next?
    Install with NuGet
    Add IronDrawing to your project
    Quickstart Guide
    Helpful resources to get started

    Need help getting started?

    Book a Free Live Demo

    See IronDrawing in action and get your licensing questions answered, or

    Key in blue circle

    Your demo request is in.

    You'll receive an invite via email shortly.

    What’s next?
    Explore Documentation
    Review Licensing Options
    badge_greencheck_in_yellowcircle
    Thank you
    Your trial key should be in the email.
    If it is not, please contact support@ironsoftware.com
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronDrawing
    Your trial key should be in the email.
    If it is not, please contact support@ironsoftware.com