Skip to content

Commit 6586c65

Browse files
Merge pull request #143 from iron-software/releases/2025.9
[devlop] Releases/2025.9
2 parents 2733819 + 3212791 commit 6586c65

File tree

3 files changed

+32
-12
lines changed

3 files changed

+32
-12
lines changed

IronSoftware.Drawing/IronSoftware.Drawing.Common.Tests/UnitTests/AnyBitmapFunctionality.cs

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void CastBitmap_to_AnyBitmap()
192192

193193
bitmap.Save("expected.bmp");
194194
anyBitmap.SaveAs("result.bmp");
195-
195+
anyBitmap.GetPixel(0, 0); //should not throw error
196196
AssertImageAreEqual("expected.bmp", "result.bmp", true);
197197
}
198198

@@ -217,7 +217,7 @@ public void CastImage_to_AnyBitmap()
217217

218218
bitmap.Save("expected.bmp");
219219
anyBitmap.SaveAs("result.bmp");
220-
220+
anyBitmap.GetPixel(0, 0); //should not throw error
221221
AssertImageAreEqual("expected.bmp", "result.bmp", true);
222222
}
223223

@@ -388,6 +388,22 @@ public void Clone_AnyBitmap()
388388
AssertImageAreEqual("expected.png", "result.png", true);
389389
}
390390

391+
[FactWithAutomaticDisplayName]
392+
public void Clone_Crop_AnyBitmap()
393+
{
394+
string imagePath = GetRelativeFilePath("van-gogh-starry-night-vincent-van-gogh.jpg");
395+
var anyBitmap = AnyBitmap.FromFile(imagePath);
396+
AnyBitmap clonedAnyBitmap = anyBitmap.Clone(new Rectangle(100,100,100,100));
397+
398+
clonedAnyBitmap.Width.Should().Be(100);
399+
clonedAnyBitmap.Height.Should().Be(100);
400+
401+
var recheckClonedAnyBitmap = AnyBitmap.FromBytes(clonedAnyBitmap.GetBytes());
402+
403+
recheckClonedAnyBitmap.Width.Should().Be(100);
404+
recheckClonedAnyBitmap.Width.Should().Be(100);
405+
}
406+
391407
[FactWithAutomaticDisplayName]
392408
public void CastSKBitmap_to_AnyBitmap()
393409
{
@@ -397,7 +413,7 @@ public void CastSKBitmap_to_AnyBitmap()
397413

398414
SaveSkiaBitmap(skBitmap, "expected.png");
399415
anyBitmap.SaveAs("result.png");
400-
416+
anyBitmap.GetPixel(0, 0); //should not throw error
401417
AssertImageAreEqual("expected.png", "result.png", true);
402418
}
403419

@@ -430,7 +446,7 @@ public void CastSKImage_to_AnyBitmap()
430446

431447
SaveSkiaImage(skImage, "expected.png");
432448
anyBitmap.SaveAs("result.png");
433-
449+
anyBitmap.GetPixel(0, 0); //should not throw error
434450
AssertImageAreEqual("expected.png", "result.png", true);
435451
}
436452

@@ -463,7 +479,7 @@ public void CastSixLabors_to_AnyBitmap()
463479

464480
imgSharp.Save("expected.bmp");
465481
anyBitmap.SaveAs("result.bmp");
466-
482+
anyBitmap.GetPixel(0, 0); //should not throw error
467483
AssertImageAreEqual("expected.bmp", "result.bmp", true);
468484
}
469485

@@ -524,7 +540,7 @@ public void CastBitmap_to_AnyBitmap_using_FromBitmap()
524540

525541
bitmap.Save("expected.png");
526542
anyBitmap.SaveAs("result.png");
527-
543+
anyBitmap.GetPixel(0, 0); //should not throw error
528544
AssertImageAreEqual("expected.png", "result.png", true);
529545
}
530546

@@ -755,6 +771,7 @@ public void Should_Resize_Image(string fileName, int width, int height)
755771
var resizeAnyBitmap = new AnyBitmap(anyBitmap, width, height);
756772
_ = resizeAnyBitmap.Width.Should().Be(width);
757773
_ = resizeAnyBitmap.Height.Should().Be(height);
774+
resizeAnyBitmap.GetPixel(0, 0); //should not throw error
758775
}
759776

760777
[FactWithAutomaticDisplayName]
@@ -936,7 +953,7 @@ public void CastMaui_to_AnyBitmap()
936953

937954
SaveMauiImages(image, "expected.bmp");
938955
anyBitmap.SaveAs("result.bmp");
939-
956+
anyBitmap.GetPixel(0, 0); //should not throw error
940957
AssertImageAreEqual("expected.bmp", "result.bmp", true);
941958
}
942959

@@ -948,7 +965,7 @@ public void CastMaui_from_AnyBitmap()
948965

949966
anyBitmap.SaveAs("expected.bmp");
950967
SaveMauiImages(image, "result.bmp");
951-
968+
anyBitmap.GetPixel(0, 0); //should not throw error
952969
AssertImageAreEqual("expected.bmp", "result.bmp", true);
953970
}
954971
#endif
@@ -972,6 +989,7 @@ public void Create_New_Image_Instance()
972989

973990
blankBitmap.Width.Should().Be(8);
974991
blankBitmap.Height.Should().Be(8);
992+
blankBitmap.GetPixel(0, 0); //should not throw error
975993
}
976994

977995
[FactWithAutomaticDisplayName]
@@ -1070,7 +1088,7 @@ public void CastAnyBitmap_from_SixLabors()
10701088

10711089
image.Save("expected.bmp");
10721090
anyBitmap.SaveAs("result.bmp");
1073-
1091+
anyBitmap.GetPixel(0, 0); //should not throw error
10741092
AssertLargeImageAreEqual("expected.bmp", "result.bmp", true);
10751093
}
10761094
#endif

IronSoftware.Drawing/IronSoftware.Drawing.Common/AnyBitmap.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public AnyBitmap Clone()
224224
public AnyBitmap Clone(Rectangle rectangle)
225225
{
226226
var cloned = GetInternalImages().Select(img => img.Clone(x => x.Crop(rectangle)));
227-
return new AnyBitmap(Binary, cloned);
227+
return new AnyBitmap(cloned);
228228
}
229229

230230
/// <summary>
@@ -3236,7 +3236,7 @@ private void LoadAndResizeImage(AnyBitmap original, int width, int height)
32363236
_lazyImage = new Lazy<IReadOnlyList<Image>>(() =>
32373237
{
32383238

3239-
using var image = Image.Load<Rgba32>(Binary);
3239+
var image = Image.Load<Rgba32>(Binary);
32403240
image.Mutate(img => img.Resize(width, height));
32413241

32423242
//update Binary

NuGet/IronSoftware.Drawing.nuspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ Supports:
4040

4141
For general support and technical inquiries, please email us at: support@ironsoftware.com</description>
4242
<summary>IronSoftware.System.Drawing is an open-source solution for .NET developers to replace System.Drawing.Common with a universal and flexible library.</summary>
43-
<releaseNotes>- Updates internal dependencies.</releaseNotes>
43+
<releaseNotes>- Optimizes AnyBitmap memory usage.
44+
- Updates Color.FromName to align with System.Drawing.
45+
- Adds support for RebeccaPurple color.</releaseNotes>
4446
<copyright>Copyright © Iron Software 2022-2025</copyright>
4547
<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>
4648
<repository type="git" url="https://github.com/iron-software/IronSoftware.Drawing.Common" commit="$commit$" />

0 commit comments

Comments
 (0)