-
-
Notifications
You must be signed in to change notification settings - Fork 45
Closed as not planned
Closed as not planned
Copy link
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp
- I have verified if the problem exist in both
DEBUGandRELEASEmode - I have searched open and closed issues to ensure it has not already been reported
ImageSharp version
4.0
Other ImageSharp packages and versions
3.0.0-alpha.0.7
Environment (Operating system, version and so on)
Ubuntu 24.04
.NET Framework version
net10.0
Description
I'm not sure if this is expected, just want to let you know.
When using a ComplexPolygon in a image.Mutate(x => x.Fill)) after upgrading to 3.0.0-alpha.0.7 it seems that the order of the point in contour of the ComplexPolygon constructor changes the result
As a workaround I can just re-order of the point and it works.
Repro: TestComplexPolygon.zip
Steps to Reproduce
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
var polygonHole = new ComplexPolygon(
[
new PointF(0, 0),
new PointF(0, 400),
new PointF(300, 400),
new PointF(300, 0),
],
/*[ By inverting the point order it works
new PointF(0, 0),
new PointF(300, 0),
new PointF(300, 400),
new PointF(0, 400),
],*/
[
new PointF(150, 100),
new PointF(50, 300),
new PointF(250, 300),
]
);
using var catImage = Image.Load("cat-original.png");
catImage.Mutate(x => x.Resize(300, 400));
using var image = new Image<Rgba32>(300, 400, Color.Transparent.ToPixel<Rgba32>());
image.Mutate(c => c.DrawImage(catImage, new Point(0, 0), new GraphicsOptions()));
image.Mutate(c => c
.SetGraphicsOptions(new GraphicsOptions
{
AlphaCompositionMode = PixelAlphaCompositionMode.DestOut,
}
)
.Fill(Color.Black, polygonHole)
);
image.SaveAsPng("output.png");
Images
Before the update
And after the update I'm getting a transparent image

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels