Skip to content

Commit da0c596

Browse files
Merge branch 'releases/2024.3' into releases/2024.3.1
2 parents 556557f + 949d4e1 commit da0c596

File tree

6 files changed

+49
-52
lines changed

6 files changed

+49
-52
lines changed

IronSoftware.Drawing/IronSoftware.Drawing.Common/Point.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ public partial class Point
1010
/// <summary>
1111
/// Gets or sets the x-coordinate of this <see cref="IronSoftware.Drawing.Point"/>.
1212
/// </summary>
13-
public double X { get; set; } = 0;
13+
public int X { get; set; } = 0;
1414

1515
/// <summary>
1616
/// Gets or sets the y-coordinate of this <see cref="IronSoftware.Drawing.Point"/>.
1717
/// </summary>
18-
public double Y { get; set; } = 0;
18+
public int Y { get; set; } = 0;
1919
/// <summary>
2020
/// Initializes a new instance of the <see cref="IronSoftware.Drawing.Point"/> struct with the specified coordinates.
2121
/// </summary>
2222
/// <param name="x"></param>
2323
/// <param name="y"></param>
24-
public Point(double x, double y)
24+
public Point(int x, int y)
2525
{
2626
X = x;
2727
Y = y;
@@ -32,7 +32,7 @@ public Point(double x, double y)
3232
/// </summary>
3333
/// <param name="dx">The amount to offset the x-coordinate.</param>
3434
/// <param name="dy">The amount to offset the y-coordinate.</param>
35-
public void Offset(double dx, double dy)
35+
public void Offset(int dx, int dy)
3636
{
3737
X += dx;
3838
Y += dy;
@@ -52,11 +52,10 @@ public static implicit operator Point(SixLabors.ImageSharp.Point point)
5252
/// <summary>
5353
/// Implicitly casts Point objects to SixLabors.ImageSharp.Point
5454
/// </summary>
55-
/// <remarks>SixLabors.ImageSharp.Point only uses int instead of double for X and Y. Decimals will be removed.</remarks>
5655
/// <param name="point">Point will automatically be casted to SixLabors.ImageSharp.Point</param>
5756
public static implicit operator SixLabors.ImageSharp.Point(Point point)
5857
{
59-
return new SixLabors.ImageSharp.Point((int)point.X, (int)point.Y);
58+
return new SixLabors.ImageSharp.Point(point.X, point.Y);
6059
}
6160

6261
/// <summary>
@@ -71,11 +70,10 @@ public static implicit operator Point(System.Drawing.Point point)
7170
/// <summary>
7271
/// Implicitly casts Point objects to System.Drawing.Point
7372
/// </summary>
74-
/// <remarks>System.Drawing.Point only uses int instead of double for X and Y. Decimals will be removed.</remarks>
7573
/// <param name="point">Point will automatically be casted to System.Drawing.Point</param>
7674
public static implicit operator System.Drawing.Point(Point point)
7775
{
78-
return new System.Drawing.Point((int)point.X, (int)point.Y);
76+
return new System.Drawing.Point(point.X, point.Y);
7977
}
8078

8179
/// <summary>
@@ -84,7 +82,7 @@ public static implicit operator System.Drawing.Point(Point point)
8482
/// <param name="point">Microsoft.Maui.Graphics.Point will automatically be casted to <see cref="Point"/> </param>
8583
public static implicit operator Point(Microsoft.Maui.Graphics.Point point)
8684
{
87-
return new Point(point.X, point.Y);
85+
return new Point((int)point.X, (int)point.Y);
8886
}
8987

9088
/// <summary>
@@ -108,11 +106,10 @@ public static implicit operator Point(SkiaSharp.SKPointI point)
108106
/// <summary>
109107
/// Implicitly casts Point objects to SkiaSharp.SKPointI
110108
/// </summary>
111-
/// <remarks>SkiaSharp.SKPointI only uses int instead of double for X and Y. Decimals will be removed.</remarks>
112109
/// <param name="point">Point will automatically be casted to SkiaSharp.SKPointI</param>
113110
public static implicit operator SkiaSharp.SKPointI(Point point)
114111
{
115-
return new SkiaSharp.SKPointI((int)point.X, (int)point.Y);
112+
return new SkiaSharp.SKPointI(point.X, point.Y);
116113
}
117114

118115
#endregion

IronSoftware.Drawing/IronSoftware.Drawing.Common/Rectangle.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public Rectangle(int x, int y, int width, int height, MeasurementUnits units = M
4848
/// <seealso cref="Rectangle"/>
4949
public Rectangle(Point point, Size size, MeasurementUnits units = MeasurementUnits.Pixels)
5050
{
51-
X = (int)point.X;
52-
Y = (int)point.Y;
51+
X = point.X;
52+
Y = point.Y;
5353
Width = size.Width;
5454
Height = size.Height;
5555
Units = units;

IronSoftware.Drawing/IronSoftware.Drawing.Common/Size.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public Size(Size size)
6060
/// <param name="point">The point.</param>
6161
public Size(Point point)
6262
{
63-
Width = (int)point.X;
64-
Height = (int)point.Y;
63+
Width = point.X;
64+
Height = point.Y;
6565
}
6666

6767
/// <summary>

NuGet/IronSoftware.Drawing.nuspec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@ Key library features include:
2424
* Color: A universally compatible Color class. Implicit casting between System.Drawing.Color, SkiaSharp.SKColor, SixLabors.ImageSharp.Color, SixLabors.ImageSharp.PixelFormats to IronSoftware.Drawing.Color
2525
* Rectangle: A universally compatible Rectangle class. Implicit casting between System.Drawing.Rectangle, SkiaSharp.SKRect, SkiaSharp.SKRectI, SixLabors.ImageSharp.Rectangle to IronSoftware.Drawing.Rectangle
2626
* Font: A universally compatible Font class. Implicit casting between System.Drawing.Font, SkiaSharp.SKFont, SixLabors.Fonts.Font to IronSoftware.Drawing.Font
27+
* Point: A universally compatible Point class. Implicit casting between System.Drawing.Point, SixLabors.ImageSharp.Point, SkiaSharp.SKPointI to IronSoftware.Drawing.Point
28+
* Size: A universally compatible Size class. Implicit casting between System.Drawing.Size, SixLabors.ImageSharp.Size, SkiaSharp.SKSizeI to IronSoftware.Drawing.Size
2729

2830
IronSoftware.Drawing can be used within C#, VB.NET, F#, ASP.NET projects, MVC, Web Services, Console &amp; Desktop Applications.
2931

3032
Supports:
33+
* .NET 8
3134
* .NET 7
3235
* .NET 6
3336
* .NET 5
3437
* .NET Core 2.0 +
3538
* .NET Framework 4.6.2 +
3639

37-
For general support and technical inquiries, please email us at: developers@ironsoftware.com</description>
40+
For general support and technical inquiries, please email us at: support@ironsoftware.com</description>
3841
<summary>IronSoftware.System.Drawing is an open-source solution for .NET developers to replace System.Drawing.Common with a universal and flexible library.</summary>
3942
<releaseNotes>- Update SixLabors.ImageSharp &amp; SixLabors.ImageSharp.Drawing to address known vulnerabilities.</releaseNotes>
4043
<copyright>Copyright © Iron Software 2022-2024</copyright>

NuGet/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[![NuGet](https://img.shields.io/nuget/v/IronSoftware.System.Drawing?color=informational&label=latest&logo=nuget)](https://www.nuget.org/packages/IronSoftware.System.Drawing/) [![Installs](https://img.shields.io/nuget/dt/IronSoftware.System.Drawing?color=informational&label=installs&logo=nuget)](https://www.nuget.org/packages/IronSoftware.System.Drawing/) [![GitHub Latest Commit](https://img.shields.io/github/last-commit/iron-software/IronSoftware.Drawing.Common?color=informational&logo=github)](https://github.com/iron-software/IronSoftware.Drawing.Common) [![GitHub Contributors](https://img.shields.io/github/contributors/iron-software/IronSoftware.Drawing.Common?color=informational&logo=github)](https://github.com/iron-software/IronSoftware.Drawing.Common) [![GitHub Issue Shield](https://img.shields.io/github/issues/iron-software/IronSoftware.System.Drawing?logo=GitHub&style=flat-square)](https://github.com/iron-software/IronSoftware.System.Drawing/issues)
22

3-
# IronSoftware.Drawing - Image, Color, Rectangle, and Font class for .NET Applications
3+
# IronSoftware.Drawing - Image, Color, Rectangle, Font, Point, and Size classes for .NET Applications
44

55
**IronSoftware.Drawing** is an free and open-source library originally developed by Iron Software that replaces System.Drawing.Common in .NET projects.
66

77
If you would like to contribute to this open-source project, please visit the public GitHub and open a branch [here](https://github.com/iron-software/IronSoftware.System.Drawing/).
88

99
## Cross platform support compatibility with:
10-
- .NET 7, .NET 6, .NET 5, .NET Core, Standard, and Framework
10+
- .NET 8, .NET 7, .NET 6, .NET 5, .NET Core, Standard, and Framework
1111
- Windows, macOS, Linux, Docker, Azure, and AWS
1212

1313
## IronSoftware.Drawing Features:
@@ -23,12 +23,14 @@ If you would like to contribute to this open-source project, please visit the pu
2323
- `SkiaSharp.SKColor`
2424
- `SixLabors.ImageSharp.Color`
2525
- `SixLabors.ImageSharp.PixelFormats`
26-
- **Rectangle**: A universally compatible Rectangle class. Implicit casting between `IronSoftware.Drawing.Rectangle` and the following supported:
26+
- **Rectangle** and **RectangleF**: A universally compatible Rectangle class. Implicit casting between `IronSoftware.Drawing.Rectangle`and `IronSoftware.Drawing.RectangleF` and the following supported:
2727
- `System.Drawing.Rectangle`
28+
- `System.Drawing.RectangleF`
2829
- `SkiaSharp.SKRect`
2930
- `SkiaSharp.SKRectI`
3031
- `SixLabors.ImageSharp.Rectangle`
31-
- **Size**: A universally compatible Size class. Implicit casting between `IronSoftware.Drawing.Size` and the following supported:
32+
- `SixLabors.ImageSharp.RectangleF`
33+
- **Size** and **SizeF**: A universally compatible Size class. Implicit casting between `IronSoftware.Drawing.Size` and `IronSoftware.Drawing.SizeF` and the following supported:
3234
- `System.Drawing.Size`
3335
- `System.Drawing.SizeF`
3436
- `SkiaSharp.SKSize`
@@ -60,4 +62,4 @@ To report an issue with IronSoftware.System.Drawing please raise them on the [Gi
6062

6163
For more information about Iron Software please visit our website: [https://ironsoftware.com/](https://ironsoftware.com/)
6264

63-
For general support and technical inquiries, please email us at: developers@ironsoftware.com
65+
For general support and technical inquiries, please email us at: support@ironsoftware.com

README.md

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,27 @@
3838

3939
- **Rectangle**: A universally compatible Rectangle class. Implicit casting between `IronSoftware.Drawing.Rectangle` and following popular Rectangle formats supported:
4040

41-
| **Implicit Casting Support** | To `Rectangle` Supported | From `Rectangle` Supported |
42-
|--------------------------------|:----------------------------:|:------------------------------:|
43-
| `System.Drawing.Rectangle` |||
44-
| `SkiaSharp.SKRect` |||
45-
| `SkiaSharp.SKRectI` |||
46-
| `SixLabors.ImageSharp.Rectangle` |||
41+
| **Implicit Casting Support** | To `Rectangle` Supported | From `Rectangle` Supported | To `RectangleF` Supported | From `RectangleF` Supported |
42+
|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:|
43+
| `System.Drawing.Rectangle` ||| | |
44+
| `System.Drawing.RectangleF` | | |||
45+
| `SkiaSharp.SKRect` | | |||
46+
| `SkiaSharp.SKRectI` ||| | |
47+
| `SixLabors.ImageSharp.Rectangle` ||| | |
48+
| `SixLabors.ImageSharp.RectangleF` | | |||
4749

4850
- **Size**: A universally compatible Size class. Implicit casting between `IronSoftware.Drawing.Size` and following popular Size formats supported:
4951

50-
| **Implicit Casting Support** | To `Size` Supported | From `Size` Supported |
51-
|--------------------------------|:----------------------------:|:------------------------------:|
52-
| `System.Drawing.Size` |||
53-
| `System.Drawing.SizeF` |||
54-
| `SkiaSharp.SKSize` |||
55-
| `SkiaSharp.SKSizeI` |||
56-
| `SixLabors.ImageSharp.Size` | ✅ | ✅
57-
| `SixLabors.ImageSharp.SizeF` | ✅ | ✅
58-
| `Microsoft.Maui.Graphics.Size` | ✅ | ✅
59-
| `Microsoft.Maui.Graphics.SizeF` | ✅ | ✅
52+
| **Implicit Casting Support** | To `Size` Supported | From `Size` Supported | To `SizeF` Supported | From `SizeF` Supported |
53+
|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:|
54+
| `System.Drawing.Size` ||| | |
55+
| `System.Drawing.SizeF` | | |||
56+
| `SkiaSharp.SKSize` | | | ||
57+
| `SkiaSharp.SKSizeI` ||| | |
58+
| `SixLabors.ImageSharp.Size` || | | |
59+
| `SixLabors.ImageSharp.SizeF` | | | | |
60+
| `Microsoft.Maui.Graphics.Size` || | | |
61+
| `Microsoft.Maui.Graphics.SizeF` | | | | |
6062

6163
- **Font**: A universally compatible Font class. Implicit casting between `IronSoftware.Drawing.Font` and following popular Font formats supported:
6264

@@ -71,6 +73,7 @@
7173
| **Implicit Casting Support** | To `Point` Supported | From `Point` Supported | To `PointF` Supported | From `PointF` Supported |
7274
|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:|
7375
| `System.Drawing.Point` ||| | |
76+
| `System.Drawing.PointF` ||| | |
7477
| `SixLabors.ImageSharp.Point` ||| | |
7578
| `SixLabors.ImageSharp.PointF` | | |||
7679
| `Microsoft.Maui.Graphics.Point` ||| | |
@@ -79,7 +82,7 @@
7982
| `SkiaSharp.SKPointI` ||| | |
8083

8184
### IronSoftware.Drawing has cross platform support compatibility with:
82-
- .NET 7, .NET 6, .NET 5, .NET Core, Standard, and Framework
85+
- .NET 8, .NET 7, .NET 6, .NET 5, .NET Core, Standard, and Framework
8386
- Windows, macOS, Linux, Docker, Azure, and AWS
8487

8588
## Using IronSoftware.Drawing
@@ -103,7 +106,7 @@ bitmap.SaveAs("result.jpg");
103106
var bytes = bitmap.ExportBytes();
104107

105108
var resultExport = new System.IO.MemoryStream();
106-
bimtap.ExportStream(resultExport, AnyBitmap.ImageFormat.Jpeg, 100);
109+
bitmap.ExportStream(resultExport, AnyBitmap.ImageFormat.Jpeg, 100);
107110

108111
// Casting between System.Drawing.Bitmap and IronSoftware.Drawing.AnyBitmap
109112
System.Drawing.Bitmap image = new System.Drawing.Bitmap("FILE_PATH");
@@ -129,7 +132,7 @@ AnyBitmap anyBitmap = AnyBitmap.CreateMultiFrameTiff(imagePaths);
129132

130133
// Manipulate image frames
131134
int frameCount = anyBitmap.FrameCount;
132-
List<AnyBitmap> frames = anyBitmap.GetAllFrames();
135+
List<AnyBitmap> frames = (List<AnyBitmap>)anyBitmap.GetAllFrames;
133136
```
134137
### `Color` Code Example
135138
```csharp
@@ -153,7 +156,7 @@ ironColor.B;
153156
ironColor.GetLuminance();
154157

155158
// Gets the 32-bit ARGB value of this Color structure.
156-
ironColor.ToArgb()
159+
ironColor.ToArgb();
157160
```
158161
### `Rectangle` Code Example
159162
```csharp
@@ -186,17 +189,9 @@ using IronSoftware.Drawing;
186189
// Create a new Size object
187190
Size size = new Size(50, 50);
188191

189-
// Create a new Size object with MeasurementUnits
190-
Size mmSize = new Size(50, 50, MeasurementUnits.Millimeters);
191-
192-
// Convert between MeasurementUnits
193-
Size pxSize = mmSize.ConvertTo(MeasurementUnits.Millimeters);
194-
// Or specify DPI
195-
Size pxSizeWithDPI = mmSize.ConvertTo(MeasurementUnits.Millimeters, 200);
196-
197192
// Casting between System.Drawing.Size and IronSoftware.Drawing.Size
198-
System.Drawing.Size size = new System.Drawing.Size(150, 150);
199-
IronSoftware.Drawing.Size ironSize = size;
193+
System.Drawing.Size systemSize = new System.Drawing.Size(150, 150);
194+
IronSoftware.Drawing.Size ironSize = systemSize;
200195

201196
ironSize.Width;
202197
ironSize.Height;
@@ -223,4 +218,4 @@ ironFont.Bold;
223218

224219
For more information about Iron Software please visit our website: [https://ironsoftware.com/](https://ironsoftware.com/)
225220

226-
For general support and technical inquiries, please email us at: developers@ironsoftware.com
221+
For general support and technical inquiries, please email us at: support@ironsoftware.com

0 commit comments

Comments
 (0)