iron-software / IronSoftware.System.Drawing

An open-source System.Drawing.Common replacement for .NET 5 and above on all platforms. Bringing together System.Drawing, Maui, and ImageSharp's Bitmap, Image, Font, and Shape types via an agnostic free NuGet package.
Other
114 stars 18 forks source link

Add Size & SizeF structs #86

Closed wolfgang-ironsoftware closed 9 months ago

wolfgang-ironsoftware commented 9 months ago

Title

Add Size & SizeF structs and modify Rectangle & RectangleF to have constructors that make use of these structs.

Description

Adds the Size & SizeF structs (somewhat simplified) from SixLabors.

Fixes #(issue number)

Doesn't fix any particular issue, but will be useful in IronPrint to specify sizes for printing.

Type of change

Please select the relevant option by placing an 'x' inside the brackets, like this: [x].

How Has This Been Tested?

Added unit tests from SixLabors.

Checklist:

Please run through the checklist as much as possible and mark the items completed by placing an 'x' inside the brackets, like this: [x].

Additional Context

Add any other context, screenshots, or information about the pull request here.

wolfgang-ironsoftware commented 9 months ago

@wolfgang-ironsoftware Could you add implicit cast for another library I saw only SixLabors.ImageSharp? We need System.Drawing, SkiaSharp, and Microsoft.Maui.Graphics.

Good idea! I'll add Monday.

wolfgang-ironsoftware commented 9 months ago

@mee-ironsoftware Added implicit converters for other libraries you mentioned.

Also added to SizeF struct (which didn't include them).

Also added VS studio generated GetHashCode() functions as required by the IEquatable interface.

wolfgang-ironsoftware commented 9 months ago

@mee-ironsoftware Added more operators just a second ago. So have conversion both to and from various types.