Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace IronSoftware.Drawing
{

/// <summary>
/// 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.
/// <para>Works nicely with popular Image Rectangle such as System.Drawing.Rectangle, SkiaSharp.SKRect, SixLabors.ImageSharp.Rectangle, Microsoft.Maui.Graphics.Rect.</para>
/// <para>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.</para>
Expand Down
8 changes: 2 additions & 6 deletions NuGet/IronSoftware.Drawing.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 &amp; Desktop Applications.
Expand All @@ -36,11 +36,7 @@ Supports:

For general support and technical inquiries, please email us at: developers@ironsoftware.com</description>
<summary>IronSoftware.System.Drawing is an open-source solution for .NET developers to replace System.Drawing.Common with a universal and flexible library.</summary>
<releaseNotes>- 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</releaseNotes>
<releaseNotes>- Changes CropRectangle class to Rectangle</releaseNotes>
<copyright>Copyright Β© Iron Software 2022-2023</copyright>
<tags>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</tags>
<repository type="git" url="https://github.com/iron-software/IronSoftware.Drawing.Common" commit="$commit$" />
Expand Down
2 changes: 1 addition & 1 deletion NuGet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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` | βœ… | βœ… |
Expand Down Expand Up @@ -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;
Expand Down