From a601177a2c74e67615b45baac5bd0ae49df4e358 Mon Sep 17 00:00:00 2001 From: Michael <97211369+michael-ironsoftware@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:21:34 +0700 Subject: [PATCH 1/8] Release 2023.12 into Master (#82) * Update CropRectangle in README * Updates /NuGet CropRectangle to Rectangle * Added missing XML tag to Legacy Class --- .../Legacy/CropRectangle.cs | 2 +- NuGet/IronSoftware.Drawing.nuspec | 8 ++----- NuGet/README.md | 2 +- README.md | 24 +++++++++---------- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/IronSoftware.Drawing/IronSoftware.Drawing.Common/Legacy/CropRectangle.cs b/IronSoftware.Drawing/IronSoftware.Drawing.Common/Legacy/CropRectangle.cs index 9203b0b..a6ec100 100644 --- a/IronSoftware.Drawing/IronSoftware.Drawing.Common/Legacy/CropRectangle.cs +++ b/IronSoftware.Drawing/IronSoftware.Drawing.Common/Legacy/CropRectangle.cs @@ -3,7 +3,7 @@ namespace IronSoftware.Drawing { - + /// /// A universally compatible Rectangle for .NET 7, .NET 6, .NET 5, and .NET Core. As well as compatibility with Windows, NanoServer, IIS, macOS, Mobile, Xamarin, iOS, Android, Google Compute, Azure, AWS, and Linux. /// Works nicely with popular Image Rectangle such as System.Drawing.Rectangle, SkiaSharp.SKRect, SixLabors.ImageSharp.Rectangle, Microsoft.Maui.Graphics.Rect. /// Implicit casting means that using this class to input and output Rectangle from public APIs gives full compatibility to all Rectangle type fully supported by Microsoft. diff --git a/NuGet/IronSoftware.Drawing.nuspec b/NuGet/IronSoftware.Drawing.nuspec index c3f607b..46adde8 100644 --- a/NuGet/IronSoftware.Drawing.nuspec +++ b/NuGet/IronSoftware.Drawing.nuspec @@ -22,7 +22,7 @@ Implicit casting means that using this class to input and output Bitmap and imag Key library features include: * AnyBitmap: A universally compatible Bitmap class. Implicit casting between System.Drawing.Bitmap, System.Drawing.Image, SkiaSharp.SKBitmap, SkiaSharp.SKImage, SixLabors.ImageSharp, Microsoft.Maui.Graphics.Platform.PlatformImage to IronSoftware.Drawing.AnyBitmap * Color: A universally compatible Color class. Implicit casting between System.Drawing.Color, SkiaSharp.SKColor, SixLabors.ImageSharp.Color, SixLabors.ImageSharp.PixelFormats to IronSoftware.Drawing.Color -* CropRectangle: A universally compatible Rectangle class. Implicit casting between System.Drawing.Rectangle, SkiaSharp.SKRect, SkiaSharp.SKRectI, SixLabors.ImageSharp.Rectangle to IronSoftware.Drawing.CropRectangle +* Rectangle: A universally compatible Rectangle class. Implicit casting between System.Drawing.Rectangle, SkiaSharp.SKRect, SkiaSharp.SKRectI, SixLabors.ImageSharp.Rectangle to IronSoftware.Drawing.Rectangle * Font: A universally compatible Font class. Implicit casting between System.Drawing.Font, SkiaSharp.SKFont, SixLabors.Fonts.Font to IronSoftware.Drawing.Font IronSoftware.Drawing can be used within C#, VB.NET, F#, ASP.NET projects, MVC, Web Services, Console & Desktop Applications. @@ -36,11 +36,7 @@ Supports: For general support and technical inquiries, please email us at: developers@ironsoftware.com IronSoftware.System.Drawing is an open-source solution for .NET developers to replace System.Drawing.Common with a universal and flexible library. - - Fixes vulnerability to CVE-2023-4863 by updating SkiaSharp dependency to 2.88.6 -- Updates SixLabors.ImageSharp.Drawing to 2.0.0 for net60 and above -- Updates SixLabors.ImageSharp to: - - 2.1.6 for netstandard2.0, netstandard2.1, MonoAndroid10.0 - - 3.0.2 for net60 and above + - Changes CropRectangle class to Rectangle Copyright © Iron Software 2022-2023 Images, Bitmap, SkiaSharp, SixLabors, BitMiracle, Maui, SVG, TIFF, TIF, GIF, JPEG, PNG, Color, Rectangle, Drawing, C#, VB.NET, ASPX, create, render, generate, standard, netstandard2.0, core, netcore diff --git a/NuGet/README.md b/NuGet/README.md index 91ebb24..962795b 100644 --- a/NuGet/README.md +++ b/NuGet/README.md @@ -23,7 +23,7 @@ If you would like to contribute to this open-source project, please visit the pu - `SkiaSharp.SKColor` - `SixLabors.ImageSharp.Color` - `SixLabors.ImageSharp.PixelFormats` -- **CropRectangle**: A universally compatible Rectangle class. Implicit casting between `IronSoftware.Drawing.CropRectangle` and the following supported: +- **Rectangle**: A universally compatible Rectangle class. Implicit casting between `IronSoftware.Drawing.Rectangle` and the following supported: - `System.Drawing.Rectangle` - `SkiaSharp.SKRect` - `SkiaSharp.SKRectI` diff --git a/README.md b/README.md index 8bb5e04..a11669e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ - [Using IronSoftware.Drawing](#using-ironsoftwaredrawing) - [AnyBitmap Example](#anybitmap-code-example) - [Color Example](#color-code-example) - - [CropRectangle Example](#croprectangle-code-example) + - [Rectangle Example](#croprectangle-code-example) - [Font Example](#font-code-example) - [Support](#support-available) @@ -35,9 +35,9 @@ | `SixLabors.ImageSharp.Color` | ✅ | ✅ | | `SixLabors.ImageSharp.PixelFormats` | ✅ | ✅ | -- **CropRectangle**: A universally compatible Rectangle class. Implicit casting between `IronSoftware.Drawing.CropRectangle` and following popular Rectangle formats supported: +- **Rectangle**: A universally compatible Rectangle class. Implicit casting between `IronSoftware.Drawing.Rectangle` and following popular Rectangle formats supported: -| **Implicit Casting Support** | To `CropRectangle` Supported | From `CropRectangle` Supported | +| **Implicit Casting Support** | To `Rectangle` Supported | From `Rectangle` Supported | |--------------------------------|:----------------------------:|:------------------------------:| | `System.Drawing.Rectangle` | ✅ | ✅ | | `SkiaSharp.SKRect` | ✅ | ✅ | @@ -141,24 +141,24 @@ ironColor.GetLuminance(); // Gets the 32-bit ARGB value of this Color structure. ironColor.ToArgb() ``` -### `CropRectangle` Code Example +### `Rectangle` Code Example ```csharp using IronSoftware.Drawing; -// Create a new CropRectangle object -CropRectangle cropRectangle = new CropRectangle(5, 5, 50, 50); +// Create a new Rectangle object +Rectangle rectangle = new Rectangle(5, 5, 50, 50); -// Create a new CropRectangle object with MeasurementUnits -CropRectangle mmRectangle = new CropRectangle(5, 5, 50, 50, MeasurementUnits.Millimeters); +// Create a new Rectangle object with MeasurementUnits +Rectangle mmRectangle = new Rectangle(5, 5, 50, 50, MeasurementUnits.Millimeters); // Convert between MeasurementUnits -CropRectangle pxRectangle = mmRectangle.ConvertTo(MeasurementUnits.Millimeters); +Rectangle pxRectangle = mmRectangle.ConvertTo(MeasurementUnits.Millimeters); // Or specify DPI -CropRectangle pxRectangleWithDPI = mmRectangle.ConvertTo(MeasurementUnits.Millimeters, 200); +Rectangle pxRectangleWithDPI = mmRectangle.ConvertTo(MeasurementUnits.Millimeters, 200); -// Casting between System.Drawing.Rectangle and IronSoftware.Drawing.CropRectangle +// Casting between System.Drawing.Rectangle and IronSoftware.Drawing.Rectangle System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(10, 10, 150, 150); -IronSoftware.Drawing.CropRectangle ironRectangle = rectangle; +IronSoftware.Drawing.Rectangle ironRectangle = rectangle; ironRectangle.X; ironRectangle.Y; From f09ffa0f32e3e6d6fbb2c52d24cd509d0e191386 Mon Sep 17 00:00:00 2001 From: Meee Date: Tue, 23 Jul 2024 09:05:18 +0700 Subject: [PATCH 2/8] chore: Update SixLabors.ImageSharp package versions to fix vulnerable --- .../IronSoftware.Drawing.Common.csproj | 108 ++++++------ NuGet/IronSoftware.Drawing.nuspec | 160 +++++++++--------- 2 files changed, 134 insertions(+), 134 deletions(-) diff --git a/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj b/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj index a31eefc..61c5db5 100644 --- a/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj +++ b/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj @@ -1,54 +1,54 @@ - - - - IronSoftware.Drawing.Common.snk - Debug;Release - true - false - true - true - false - latest - CS8002 - AnyCPU - true - netstandard2.0;netstandard2.1;net60 - true - - - - AnyCPU - DEBUG;TRACE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - portable - true - - - + + + + IronSoftware.Drawing.Common.snk + Debug;Release + true + false + true + true + false + latest + CS8002 + AnyCPU + true + netstandard2.0;netstandard2.1;net60 + true + + + + AnyCPU + DEBUG;TRACE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + portable + true + + + diff --git a/NuGet/IronSoftware.Drawing.nuspec b/NuGet/IronSoftware.Drawing.nuspec index d0f5104..ca1c4a7 100644 --- a/NuGet/IronSoftware.Drawing.nuspec +++ b/NuGet/IronSoftware.Drawing.nuspec @@ -1,81 +1,81 @@ - - - - IronSoftware.System.Drawing - $version$ - IronSoftware.System.Drawing - https://ironsoftware.com/ - - false - LICENSE.txt - https://github.com/iron-software/IronSoftware.Drawing.Common/ - images/ironsoftware-logo.png - docs\README.md - IronSoftware.System.Drawing - The C# Image Library - -A universally compatible Bitmap format for .NET 8, .NET 7, .NET 6, and .NET 5, .NET Core on Windows, macOS, Linux, Docker, AWS, Azure, NanoServer, IIS, Mobile, Xamarin, iOS, Android, and Google Compute. - -Works seamlessly with popular Image and Bitmap formats such as System.Drawing.Bitmap, SkiaSharp, SixLabors.ImageSharp, Microsoft.Maui.Graphics. - -Implicit casting means that using this class to input and output Bitmap and image types from public API's gives full compatibility to all image type fully supported by Microsoft. - -Key library features include: -* AnyBitmap: A universally compatible Bitmap class. Implicit casting between System.Drawing.Bitmap, System.Drawing.Image, SkiaSharp.SKBitmap, SkiaSharp.SKImage, SixLabors.ImageSharp, Microsoft.Maui.Graphics.Platform.PlatformImage to IronSoftware.Drawing.AnyBitmap -* Color: A universally compatible Color class. Implicit casting between System.Drawing.Color, SkiaSharp.SKColor, SixLabors.ImageSharp.Color, SixLabors.ImageSharp.PixelFormats to IronSoftware.Drawing.Color -* Rectangle: A universally compatible Rectangle class. Implicit casting between System.Drawing.Rectangle, SkiaSharp.SKRect, SkiaSharp.SKRectI, SixLabors.ImageSharp.Rectangle to IronSoftware.Drawing.Rectangle -* Font: A universally compatible Font class. Implicit casting between System.Drawing.Font, SkiaSharp.SKFont, SixLabors.Fonts.Font to IronSoftware.Drawing.Font -* Point: A universally compatible Point class. Implicit casting between System.Drawing.Point, SixLabors.ImageSharp.Point, SkiaSharp.SKPointI to IronSoftware.Drawing.Point -* Size: A universally compatible Size class. Implicit casting between System.Drawing.Size, SixLabors.ImageSharp.Size, SkiaSharp.SKSizeI to IronSoftware.Drawing.Size - -IronSoftware.Drawing can be used within C#, VB.NET, F#, ASP.NET projects, MVC, Web Services, Console & Desktop Applications. - -Supports: -* .NET 8 -* .NET 7 -* .NET 6 -* .NET 5 -* .NET Core 2.0 + -* .NET Framework 4.6.2 + - -For general support and technical inquiries, please email us at: support@ironsoftware.com - IronSoftware.System.Drawing is an open-source solution for .NET developers to replace System.Drawing.Common with a universal and flexible library. - - Efficient compression significantly reduces output TIFF file size (Up to 80%). -- Automatic compression when creating multi-frame TIFFs. -- Fix the issue of exception error thrown when converting Bitmap to AnyBitmap. - Copyright © Iron Software 2022-2024 - Images, Bitmap, SkiaSharp, SixLabors, BitMiracle, Maui, SVG, TIFF, TIF, GIF, JPEG, PNG, Color, Rectangle, Drawing, C#, VB.NET, ASPX, create, render, generate, standard, netstandard2.0, core, netcore - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + IronSoftware.System.Drawing + $version$ + IronSoftware.System.Drawing + https://ironsoftware.com/ + + false + LICENSE.txt + https://github.com/iron-software/IronSoftware.Drawing.Common/ + images/ironsoftware-logo.png + docs\README.md + IronSoftware.System.Drawing - The C# Image Library + +A universally compatible Bitmap format for .NET 8, .NET 7, .NET 6, and .NET 5, .NET Core on Windows, macOS, Linux, Docker, AWS, Azure, NanoServer, IIS, Mobile, Xamarin, iOS, Android, and Google Compute. + +Works seamlessly with popular Image and Bitmap formats such as System.Drawing.Bitmap, SkiaSharp, SixLabors.ImageSharp, Microsoft.Maui.Graphics. + +Implicit casting means that using this class to input and output Bitmap and image types from public API's gives full compatibility to all image type fully supported by Microsoft. + +Key library features include: +* AnyBitmap: A universally compatible Bitmap class. Implicit casting between System.Drawing.Bitmap, System.Drawing.Image, SkiaSharp.SKBitmap, SkiaSharp.SKImage, SixLabors.ImageSharp, Microsoft.Maui.Graphics.Platform.PlatformImage to IronSoftware.Drawing.AnyBitmap +* Color: A universally compatible Color class. Implicit casting between System.Drawing.Color, SkiaSharp.SKColor, SixLabors.ImageSharp.Color, SixLabors.ImageSharp.PixelFormats to IronSoftware.Drawing.Color +* Rectangle: A universally compatible Rectangle class. Implicit casting between System.Drawing.Rectangle, SkiaSharp.SKRect, SkiaSharp.SKRectI, SixLabors.ImageSharp.Rectangle to IronSoftware.Drawing.Rectangle +* Font: A universally compatible Font class. Implicit casting between System.Drawing.Font, SkiaSharp.SKFont, SixLabors.Fonts.Font to IronSoftware.Drawing.Font +* Point: A universally compatible Point class. Implicit casting between System.Drawing.Point, SixLabors.ImageSharp.Point, SkiaSharp.SKPointI to IronSoftware.Drawing.Point +* Size: A universally compatible Size class. Implicit casting between System.Drawing.Size, SixLabors.ImageSharp.Size, SkiaSharp.SKSizeI to IronSoftware.Drawing.Size + +IronSoftware.Drawing can be used within C#, VB.NET, F#, ASP.NET projects, MVC, Web Services, Console & Desktop Applications. + +Supports: +* .NET 8 +* .NET 7 +* .NET 6 +* .NET 5 +* .NET Core 2.0 + +* .NET Framework 4.6.2 + + +For general support and technical inquiries, please email us at: support@ironsoftware.com + IronSoftware.System.Drawing is an open-source solution for .NET developers to replace System.Drawing.Common with a universal and flexible library. + - Efficient compression significantly reduces output TIFF file size (Up to 80%). +- Automatic compression when creating multi-frame TIFFs. +- Fix the issue of exception error thrown when converting Bitmap to AnyBitmap. + Copyright © Iron Software 2022-2024 + Images, Bitmap, SkiaSharp, SixLabors, BitMiracle, Maui, SVG, TIFF, TIF, GIF, JPEG, PNG, Color, Rectangle, Drawing, C#, VB.NET, ASPX, create, render, generate, standard, netstandard2.0, core, netcore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 1f817d5e5780284d7db23c92846f42214037fb35 Mon Sep 17 00:00:00 2001 From: Meee Date: Tue, 23 Jul 2024 09:09:42 +0700 Subject: [PATCH 3/8] chore: Update SixLabors.ImageSharp.Drawing package version to 2.1.4 --- .../IronSoftware.Drawing.Common.csproj | 2 +- NuGet/IronSoftware.Drawing.nuspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj b/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj index 61c5db5..5d1e0ca 100644 --- a/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj +++ b/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj @@ -35,7 +35,7 @@ - + diff --git a/NuGet/IronSoftware.Drawing.nuspec b/NuGet/IronSoftware.Drawing.nuspec index ca1c4a7..afcdad5 100644 --- a/NuGet/IronSoftware.Drawing.nuspec +++ b/NuGet/IronSoftware.Drawing.nuspec @@ -54,7 +54,7 @@ For general support and technical inquiries, please email us at: support@ironsof - + From 22ceb6a82965bff062bbeb4c65200b12d4442c36 Mon Sep 17 00:00:00 2001 From: Meee Date: Tue, 23 Jul 2024 09:10:42 +0700 Subject: [PATCH 4/8] NuGet: Update release notes --- NuGet/IronSoftware.Drawing.nuspec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/NuGet/IronSoftware.Drawing.nuspec b/NuGet/IronSoftware.Drawing.nuspec index afcdad5..7e98d8b 100644 --- a/NuGet/IronSoftware.Drawing.nuspec +++ b/NuGet/IronSoftware.Drawing.nuspec @@ -39,9 +39,7 @@ Supports: For general support and technical inquiries, please email us at: support@ironsoftware.com IronSoftware.System.Drawing is an open-source solution for .NET developers to replace System.Drawing.Common with a universal and flexible library. - - Efficient compression significantly reduces output TIFF file size (Up to 80%). -- Automatic compression when creating multi-frame TIFFs. -- Fix the issue of exception error thrown when converting Bitmap to AnyBitmap. + - Update SixLabors.ImageSharp & SixLabors.ImageSharp.Drawing to address known vulnerabilities. Copyright © Iron Software 2022-2024 Images, Bitmap, SkiaSharp, SixLabors, BitMiracle, Maui, SVG, TIFF, TIF, GIF, JPEG, PNG, Color, Rectangle, Drawing, C#, VB.NET, ASPX, create, render, generate, standard, netstandard2.0, core, netcore From 8d1099392b774c0b2a2df6c0664f7bb5870d1d93 Mon Sep 17 00:00:00 2001 From: Meee Date: Thu, 14 Nov 2024 15:26:57 +0700 Subject: [PATCH 5/8] Dependencies: Change to use IronSoftware.Drawing.Abstractions instead of IronSoftware.Common --- .../IronSoftware.Drawing.Common.csproj | 2 +- NuGet/IronSoftware.Drawing.nuspec | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj b/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj index 55641ff..590bc93 100644 --- a/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj +++ b/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj @@ -25,7 +25,7 @@ - + diff --git a/NuGet/IronSoftware.Drawing.nuspec b/NuGet/IronSoftware.Drawing.nuspec index cae3054..3aaa1c9 100644 --- a/NuGet/IronSoftware.Drawing.nuspec +++ b/NuGet/IronSoftware.Drawing.nuspec @@ -45,21 +45,21 @@ For general support and technical inquiries, please email us at: support@ironsof - + - + - + From 30b048c950f37b0bfe8fdc88613989dbcdcffc07 Mon Sep 17 00:00:00 2001 From: Michael <97211369+michael-ironsoftware@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:21:34 +0700 Subject: [PATCH 6/8] Release 2023.12 into Master (#82) * Update CropRectangle in README * Updates /NuGet CropRectangle to Rectangle * Added missing XML tag to Legacy Class --- README.md | 442 +++++++++++++++++++++++++++--------------------------- 1 file changed, 221 insertions(+), 221 deletions(-) diff --git a/README.md b/README.md index 0d3b370..7b9de65 100644 --- a/README.md +++ b/README.md @@ -1,221 +1,221 @@ -[![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) - -# IronSoftware.Drawing - Image, Color, Rectangle, and Font class for .NET Applications - -**IronSoftware.Drawing** is an open-source library originally developed by Iron Software that helps C# Software Engineers to replace System.Drawing.Common in .NET projects. - -## Table of Contents - -- [Features](#ironsoftwaredrawing-features) - - [Compatibility](#ironsoftwaredrawing-has-cross-platform-support-compatibility-with) -- [Using IronSoftware.Drawing](#using-ironsoftwaredrawing) - - [AnyBitmap Example](#anybitmap-code-example) - - [Color Example](#color-code-example) - - [Rectangle Example](#rectangle-code-example) - - [Size Example](#size-code-example) - - [Font Example](#font-code-example) -- [Support](#support-available) - -## IronSoftware.Drawing Features: -- **AnyBitmap**: A universally compatible Bitmap class. Implicit casting between `IronSoftware.Drawing.AnyBitmap` and following popular Bitmap/Image formats supported: - -| **Implicit Casting Support** | To `AnyBitmap` Supported | From `AnyBitmap` Supported | -|------------------------------------------------------------------------|:--------------------------:|:----------------------------:| -| `System.Drawing.Bitmap` | ✅ | ✅ | -| `System.Drawing.Image` | ✅ | ✅ | -| `SkiaSharp.SKBitmap` | ✅ | ✅ | -| `SkiaSharp.SKImage` | ✅ | ✅ | -| `SixLabors.ImageSharp` | ✅ | ✅ | -| `Microsoft.Maui.Graphics.Platform.PlatformImage` | ✅ | ✅ | - -- **Color**: A universally compatible Color class. Implicit casting between `IronSoftware.Drawing.Color` and following popular Color formats supported: - -| **Implicit Casting Support** | To `Color` Supported | From `Color` Supported | -|-----------------------------------|:--------------------:|:----------------------:| -| `SkiaSharp.SKColor` | ✅ | ✅ | -| `SixLabors.ImageSharp.Color` | ✅ | ✅ | -| `SixLabors.ImageSharp.PixelFormats` | ✅ | ✅ | - -- **Rectangle**: A universally compatible Rectangle class. Implicit casting between `IronSoftware.Drawing.Rectangle` and following popular Rectangle formats supported: - -| **Implicit Casting Support** | To `Rectangle` Supported | From `Rectangle` Supported | To `RectangleF` Supported | From `RectangleF` Supported | -|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:| -| `System.Drawing.Rectangle` | ✅ | ✅ | | | -| `System.Drawing.RectangleF` | | | ✅ | ✅ | -| `SkiaSharp.SKRect` | | | ✅ | ✅ | -| `SkiaSharp.SKRectI` | ✅ | ✅ | | | -| `SixLabors.ImageSharp.Rectangle` | ✅ | ✅ | | | -| `SixLabors.ImageSharp.RectangleF` | | | ✅ | ✅ | - -- **Size**: A universally compatible Size class. Implicit casting between `IronSoftware.Drawing.Size` and following popular Size formats supported: - -| **Implicit Casting Support** | To `Size` Supported | From `Size` Supported | To `SizeF` Supported | From `SizeF` Supported | -|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:| -| `System.Drawing.Size` | ✅ | ✅ | | | -| `System.Drawing.SizeF` | | | ✅ | ✅ | -| `SkiaSharp.SKSize` | | | ✅ | ✅ | -| `SkiaSharp.SKSizeI` | ✅ | ✅ | | | -| `SixLabors.ImageSharp.Size` | ✅ | ✅ | | | -| `SixLabors.ImageSharp.SizeF` | | | ✅ | ✅ | -| `Microsoft.Maui.Graphics.Size` | ✅ | ✅ | | | -| `Microsoft.Maui.Graphics.SizeF` | | | ✅ | ✅ | - -- **Font**: A universally compatible Font class. Implicit casting between `IronSoftware.Drawing.Font` and following popular Font formats supported: - -| **Implicit Casting Support** | To `Font` Supported | From `Font` Supported | -|----------------------------|:-------------------:|:---------------------:| -| `System.Drawing.Font` | ✅ | ✅ | -| `SkiaSharp.SKFont` | ✅ | ✅ | -| `SixLabors.Fonts.Font` | ✅ | ✅ | - -- **Point** and **PointF**: Universally compatible Point and PointF classes. Implicit casting between `IronSoftware.Drawing.Point` and `IronSoftware.Drawing.PointF` and the following supported: - -| **Implicit Casting Support** | To `Point` Supported | From `Point` Supported | To `PointF` Supported | From `PointF` Supported | -|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:| -| `System.Drawing.Point` | ✅ | ✅ | | | -| `System.Drawing.PointF` | ✅ | ✅ | | | -| `SixLabors.ImageSharp.Point` | ✅ | ✅ | | | -| `SixLabors.ImageSharp.PointF` | | | ✅ | ✅ | -| `Microsoft.Maui.Graphics.Point` | ✅ | ✅ | | | -| `Microsoft.Maui.Graphics.PointF` | | | ✅ | ✅ | -| `SkiaSharp.SKPoint` | | | ✅ | ✅ | -| `SkiaSharp.SKPointI` | ✅ | ✅ | | | - -### IronSoftware.Drawing has cross platform support compatibility with: -- .NET 8, .NET 7, .NET 6, .NET 5, .NET Core, Standard, and Framework -- Windows, macOS, Linux, Docker, Azure, and AWS - -## Using IronSoftware.Drawing - -Installing the IronSoftware.Drawing NuGet package is quick and easy, please install the package like this: -``` -PM> Install-Package IronSoftware.System.Drawing -``` -Alternatively, download directly from the [official NuGet website](https://www.nuget.org/packages/IronSoftware.System.Drawing). - - -Once installed, you can get started by adding `using IronSoftware.Drawing;` to the top of your C# code. -### `AnyBitmap` Code Example -```csharp -using IronSoftware.Drawing; - -// Create a new AnyBitmap object -var bitmap = AnyBitmap.FromFile("FILE_PATH"); -bitmap.SaveAs("result.jpg"); - -var bytes = bitmap.ExportBytes(); - -var resultExport = new System.IO.MemoryStream(); -bitmap.ExportStream(resultExport, AnyBitmap.ImageFormat.Jpeg, 100); - -// Casting between System.Drawing.Bitmap and IronSoftware.Drawing.AnyBitmap -System.Drawing.Bitmap image = new System.Drawing.Bitmap("FILE_PATH"); -IronSoftware.Drawing.AnyBitmap anyBitmap = image; -anyBitmap.SaveAs("result-from-casting.png"); - - -// Creates a Multi-page Tiff-style AnyBitmap from an Image array -List bitmaps = new List() -{ - AnyBitmap.FromFile("FILE_PATH_1"), - AnyBitmap.FromFile("FILE_PATH_2") -}; -AnyBitmap anyBitmap = AnyBitmap.CreateMultiFrameTiff(bitmaps); - -// Creates a Multi-page Tiff-style AnyBitmap from a fully qualified file path array -List imagePaths = new List() -{ - "FILE_PATH_1", - "FILE_PATH_2" -}; -AnyBitmap anyBitmap = AnyBitmap.CreateMultiFrameTiff(imagePaths); - -// Manipulate image frames -int frameCount = anyBitmap.FrameCount; -List frames = (List)anyBitmap.GetAllFrames; -``` -### `Color` Code Example -```csharp -using IronSoftware.Drawing; - -// Create a new Color object -Color fromHex = new Color("#191919"); -Color fromRgb = new Color(255, 255, 0); -Color fromEnum = Color.Crimson; - -// Casting between System.Drawing.Color and IronSoftware.Drawing.Color -System.Drawing.Color drawingColor = System.Drawing.Color.Red; -IronSoftware.Drawing.Color ironColor = drawingColor; - -ironColor.A; -ironColor.R; -ironColor.G; -ironColor.B; - -// Luminance is a value from 0 (black) to 100 (white) where 50 is the perceptual "middle grey" -ironColor.GetLuminance(); - -// Gets the 32-bit ARGB value of this Color structure. -ironColor.ToArgb(); -``` -### `Rectangle` Code Example -```csharp -using IronSoftware.Drawing; - -// Create a new Rectangle object -Rectangle rectangle = new Rectangle(5, 5, 50, 50); - -// Create a new Rectangle object with MeasurementUnits -Rectangle mmRectangle = new Rectangle(5, 5, 50, 50, MeasurementUnits.Millimeters); - -// Convert between MeasurementUnits -Rectangle pxRectangle = mmRectangle.ConvertTo(MeasurementUnits.Millimeters); -// Or specify DPI -Rectangle pxRectangleWithDPI = mmRectangle.ConvertTo(MeasurementUnits.Millimeters, 200); - -// Casting between System.Drawing.Rectangle and IronSoftware.Drawing.Rectangle -System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(10, 10, 150, 150); -IronSoftware.Drawing.Rectangle ironRectangle = rectangle; - -ironRectangle.X; -ironRectangle.Y; -ironRectangle.Width; -ironRectangle.Height; -``` -### `Size` Code Example -```csharp -using IronSoftware.Drawing; - -// Create a new Size object -Size size = new Size(50, 50); - -// Casting between System.Drawing.Size and IronSoftware.Drawing.Size -System.Drawing.Size systemSize = new System.Drawing.Size(150, 150); -IronSoftware.Drawing.Size ironSize = systemSize; - -ironSize.Width; -ironSize.Height; -``` -### `Font` Code Example -```csharp -using IronSoftware.Drawing; - -// Create a new Font object -Font font = new Font("Times New Roman", FontStyle.Italic | FontStyle.Bold, 30); - -// Casting between System.Drawing.Font and IronSoftware.Drawing.Font -System.Drawing.Font drawingFont = new System.Drawing.Font("Courier New", 30); -IronSoftware.Drawing.Font ironFont = drawingFont; - -ironFont.FamilyName; -ironFont.Style; -ironFont.Size; -ironFont.Italic; -ironFont.Bold; -``` - -## Support Available - -For more information about Iron Software please visit our website: [https://ironsoftware.com/](https://ironsoftware.com/) - -For general support and technical inquiries, please email us at: support@ironsoftware.com +[![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) + +# IronSoftware.Drawing - Image, Color, Rectangle, and Font class for .NET Applications + +**IronSoftware.Drawing** is an open-source library originally developed by Iron Software that helps C# Software Engineers to replace System.Drawing.Common in .NET projects. + +## Table of Contents + +- [Features](#ironsoftwaredrawing-features) + - [Compatibility](#ironsoftwaredrawing-has-cross-platform-support-compatibility-with) +- [Using IronSoftware.Drawing](#using-ironsoftwaredrawing) + - [AnyBitmap Example](#anybitmap-code-example) + - [Color Example](#color-code-example) + - [Rectangle Example](#rectangle-code-example) + - [Size Example](#size-code-example) + - [Font Example](#font-code-example) +- [Support](#support-available) + +## IronSoftware.Drawing Features: +- **AnyBitmap**: A universally compatible Bitmap class. Implicit casting between `IronSoftware.Drawing.AnyBitmap` and following popular Bitmap/Image formats supported: + +| **Implicit Casting Support** | To `AnyBitmap` Supported | From `AnyBitmap` Supported | +|------------------------------------------------------------------------|:--------------------------:|:----------------------------:| +| `System.Drawing.Bitmap` | ✅ | ✅ | +| `System.Drawing.Image` | ✅ | ✅ | +| `SkiaSharp.SKBitmap` | ✅ | ✅ | +| `SkiaSharp.SKImage` | ✅ | ✅ | +| `SixLabors.ImageSharp` | ✅ | ✅ | +| `Microsoft.Maui.Graphics.Platform.PlatformImage` | ✅ | ✅ | + +- **Color**: A universally compatible Color class. Implicit casting between `IronSoftware.Drawing.Color` and following popular Color formats supported: + +| **Implicit Casting Support** | To `Color` Supported | From `Color` Supported | +|-----------------------------------|:--------------------:|:----------------------:| +| `SkiaSharp.SKColor` | ✅ | ✅ | +| `SixLabors.ImageSharp.Color` | ✅ | ✅ | +| `SixLabors.ImageSharp.PixelFormats` | ✅ | ✅ | + +- **Rectangle**: A universally compatible Rectangle class. Implicit casting between `IronSoftware.Drawing.Rectangle` and following popular Rectangle formats supported: + +| **Implicit Casting Support** | To `Rectangle` Supported | From `Rectangle` Supported | To `RectangleF` Supported | From `RectangleF` Supported | +|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:| +| `System.Drawing.Rectangle` | ✅ | ✅ | | | +| `System.Drawing.RectangleF` | | | ✅ | ✅ | +| `SkiaSharp.SKRect` | | | ✅ | ✅ | +| `SkiaSharp.SKRectI` | ✅ | ✅ | | | +| `SixLabors.ImageSharp.Rectangle` | ✅ | ✅ | | | +| `SixLabors.ImageSharp.RectangleF` | | | ✅ | ✅ | + +- **Size**: A universally compatible Size class. Implicit casting between `IronSoftware.Drawing.Size` and following popular Size formats supported: + +| **Implicit Casting Support** | To `Size` Supported | From `Size` Supported | To `SizeF` Supported | From `SizeF` Supported | +|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:| +| `System.Drawing.Size` | ✅ | ✅ | | | +| `System.Drawing.SizeF` | | | ✅ | ✅ | +| `SkiaSharp.SKSize` | | | ✅ | ✅ | +| `SkiaSharp.SKSizeI` | ✅ | ✅ | | | +| `SixLabors.ImageSharp.Size` | ✅ | ✅ | | | +| `SixLabors.ImageSharp.SizeF` | | | ✅ | ✅ | +| `Microsoft.Maui.Graphics.Size` | ✅ | ✅ | | | +| `Microsoft.Maui.Graphics.SizeF` | | | ✅ | ✅ | + +- **Font**: A universally compatible Font class. Implicit casting between `IronSoftware.Drawing.Font` and following popular Font formats supported: + +| **Implicit Casting Support** | To `Font` Supported | From `Font` Supported | +|----------------------------|:-------------------:|:---------------------:| +| `System.Drawing.Font` | ✅ | ✅ | +| `SkiaSharp.SKFont` | ✅ | ✅ | +| `SixLabors.Fonts.Font` | ✅ | ✅ | + +- **Point** and **PointF**: Universally compatible Point and PointF classes. Implicit casting between `IronSoftware.Drawing.Point` and `IronSoftware.Drawing.PointF` and the following supported: + +| **Implicit Casting Support** | To `Point` Supported | From `Point` Supported | To `PointF` Supported | From `PointF` Supported | +|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:| +| `System.Drawing.Point` | ✅ | ✅ | | | +| `System.Drawing.PointF` | ✅ | ✅ | | | +| `SixLabors.ImageSharp.Point` | ✅ | ✅ | | | +| `SixLabors.ImageSharp.PointF` | | | ✅ | ✅ | +| `Microsoft.Maui.Graphics.Point` | ✅ | ✅ | | | +| `Microsoft.Maui.Graphics.PointF` | | | ✅ | ✅ | +| `SkiaSharp.SKPoint` | | | ✅ | ✅ | +| `SkiaSharp.SKPointI` | ✅ | ✅ | | | + +### IronSoftware.Drawing has cross platform support compatibility with: +- .NET 8, .NET 7, .NET 6, .NET 5, .NET Core, Standard, and Framework +- Windows, macOS, Linux, Docker, Azure, and AWS + +## Using IronSoftware.Drawing + +Installing the IronSoftware.Drawing NuGet package is quick and easy, please install the package like this: +``` +PM> Install-Package IronSoftware.System.Drawing +``` +Alternatively, download directly from the [official NuGet website](https://www.nuget.org/packages/IronSoftware.System.Drawing). + + +Once installed, you can get started by adding `using IronSoftware.Drawing;` to the top of your C# code. +### `AnyBitmap` Code Example +```csharp +using IronSoftware.Drawing; + +// Create a new AnyBitmap object +var bitmap = AnyBitmap.FromFile("FILE_PATH"); +bitmap.SaveAs("result.jpg"); + +var bytes = bitmap.ExportBytes(); + +var resultExport = new System.IO.MemoryStream(); +bitmap.ExportStream(resultExport, AnyBitmap.ImageFormat.Jpeg, 100); + +// Casting between System.Drawing.Bitmap and IronSoftware.Drawing.AnyBitmap +System.Drawing.Bitmap image = new System.Drawing.Bitmap("FILE_PATH"); +IronSoftware.Drawing.AnyBitmap anyBitmap = image; +anyBitmap.SaveAs("result-from-casting.png"); + + +// Creates a Multi-page Tiff-style AnyBitmap from an Image array +List bitmaps = new List() +{ + AnyBitmap.FromFile("FILE_PATH_1"), + AnyBitmap.FromFile("FILE_PATH_2") +}; +AnyBitmap anyBitmap = AnyBitmap.CreateMultiFrameTiff(bitmaps); + +// Creates a Multi-page Tiff-style AnyBitmap from a fully qualified file path array +List imagePaths = new List() +{ + "FILE_PATH_1", + "FILE_PATH_2" +}; +AnyBitmap anyBitmap = AnyBitmap.CreateMultiFrameTiff(imagePaths); + +// Manipulate image frames +int frameCount = anyBitmap.FrameCount; +List frames = (List)anyBitmap.GetAllFrames; +``` +### `Color` Code Example +```csharp +using IronSoftware.Drawing; + +// Create a new Color object +Color fromHex = new Color("#191919"); +Color fromRgb = new Color(255, 255, 0); +Color fromEnum = Color.Crimson; + +// Casting between System.Drawing.Color and IronSoftware.Drawing.Color +System.Drawing.Color drawingColor = System.Drawing.Color.Red; +IronSoftware.Drawing.Color ironColor = drawingColor; + +ironColor.A; +ironColor.R; +ironColor.G; +ironColor.B; + +// Luminance is a value from 0 (black) to 100 (white) where 50 is the perceptual "middle grey" +ironColor.GetLuminance(); + +// Gets the 32-bit ARGB value of this Color structure. +ironColor.ToArgb(); +``` +### `Rectangle` Code Example +```csharp +using IronSoftware.Drawing; + +// Create a new Rectangle object +Rectangle rectangle = new Rectangle(5, 5, 50, 50); + +// Create a new Rectangle object with MeasurementUnits +Rectangle mmRectangle = new Rectangle(5, 5, 50, 50, MeasurementUnits.Millimeters); + +// Convert between MeasurementUnits +Rectangle pxRectangle = mmRectangle.ConvertTo(MeasurementUnits.Millimeters); +// Or specify DPI +Rectangle pxRectangleWithDPI = mmRectangle.ConvertTo(MeasurementUnits.Millimeters, 200); + +// Casting between System.Drawing.Rectangle and IronSoftware.Drawing.Rectangle +System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(10, 10, 150, 150); +IronSoftware.Drawing.Rectangle ironRectangle = rectangle; + +ironRectangle.X; +ironRectangle.Y; +ironRectangle.Width; +ironRectangle.Height; +``` +### `Size` Code Example +```csharp +using IronSoftware.Drawing; + +// Create a new Size object +Size size = new Size(50, 50); + +// Casting between System.Drawing.Size and IronSoftware.Drawing.Size +System.Drawing.Size systemSize = new System.Drawing.Size(150, 150); +IronSoftware.Drawing.Size ironSize = systemSize; + +ironSize.Width; +ironSize.Height; +``` +### `Font` Code Example +```csharp +using IronSoftware.Drawing; + +// Create a new Font object +Font font = new Font("Times New Roman", FontStyle.Italic | FontStyle.Bold, 30); + +// Casting between System.Drawing.Font and IronSoftware.Drawing.Font +System.Drawing.Font drawingFont = new System.Drawing.Font("Courier New", 30); +IronSoftware.Drawing.Font ironFont = drawingFont; + +ironFont.FamilyName; +ironFont.Style; +ironFont.Size; +ironFont.Italic; +ironFont.Bold; +``` + +## Support Available + +For more information about Iron Software please visit our website: [https://ironsoftware.com/](https://ironsoftware.com/) + +For general support and technical inquiries, please email us at: support@ironsoftware.com From 5ee302acc28add6f149349e9bf155ce0bf01dba6 Mon Sep 17 00:00:00 2001 From: Meee Date: Tue, 23 Jul 2024 09:05:18 +0700 Subject: [PATCH 7/8] chore: Update SixLabors.ImageSharp package versions to fix vulnerable --- .../IronSoftware.Drawing.Common.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj b/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj index 590bc93..9163468 100644 --- a/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj +++ b/IronSoftware.Drawing/IronSoftware.Drawing.Common/IronSoftware.Drawing.Common.csproj @@ -1,4 +1,4 @@ - + IronSoftware.Drawing.Common.snk From 1470b37b951e2358a1103a607187d1b23d897d10 Mon Sep 17 00:00:00 2001 From: Meee Date: Thu, 14 Nov 2024 16:14:28 +0700 Subject: [PATCH 8/8] Tests: Update to test NET4.8 instead of NET4.7.2 --- CI/stage_templates/run_tests_on_pool.yml | 12 ++++++------ .../IronSoftware.Drawing.Common.Tests.csproj | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CI/stage_templates/run_tests_on_pool.yml b/CI/stage_templates/run_tests_on_pool.yml index b2abb23..e3dccff 100644 --- a/CI/stage_templates/run_tests_on_pool.yml +++ b/CI/stage_templates/run_tests_on_pool.yml @@ -16,20 +16,20 @@ stages: - script: echo "Skip Unit tests" - ${{ if eq(parameters.runUnitTests, true) }}: - ${{ if eq(parameters.OSPlatform, 'Windows') }}: - # Windows .NET 472 x86 Tests + # Windows .NET 48 x86 Tests - template: ../job_templates/test_drawing_libraries.yml parameters: - name: UnitTest${{ parameters.OSPlatform }}net472x86 + name: UnitTest${{ parameters.OSPlatform }}net48x86 OSPlatform: ${{ parameters.OSPlatform }} - framework: 'net472' + framework: 'net48' architecture: '.x86' buildConfiguration: $(Configuration) - # Windows .NET 472 x64 Tests + # Windows .NET 48 x64 Tests - template: ../job_templates/test_drawing_libraries.yml parameters: - name: UnitTest${{ parameters.OSPlatform }}net472x64 + name: UnitTest${{ parameters.OSPlatform }}net48x64 OSPlatform: ${{ parameters.OSPlatform }} - framework: 'net472' + framework: 'net48' architecture: '' buildConfiguration: $(Configuration) # .NET 8.0 Tests diff --git a/IronSoftware.Drawing/IronSoftware.Drawing.Common.Tests/IronSoftware.Drawing.Common.Tests.csproj b/IronSoftware.Drawing/IronSoftware.Drawing.Common.Tests/IronSoftware.Drawing.Common.Tests.csproj index ba9c9e3..3023262 100644 --- a/IronSoftware.Drawing/IronSoftware.Drawing.Common.Tests/IronSoftware.Drawing.Common.Tests.csproj +++ b/IronSoftware.Drawing/IronSoftware.Drawing.Common.Tests/IronSoftware.Drawing.Common.Tests.csproj @@ -1,7 +1,7 @@  - net472;net80 + net48;net80 latest false false