-
-
Notifications
You must be signed in to change notification settings - Fork 888
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 alpha 46
Other ImageSharp packages and versions
none
Environment (Operating system, version and so on)
Ubuntu 24.04
.NET Framework version
.NET 9
Description
Hello,
Following #2753 I finally found some time to do more test and I found some issues are still present. (Sorry for not testing this sooner)
It's also possible I misunderstood something, let me know if I missed something
Steps to Reproduce
For the following example, I'm starting with an image of a square 4x4 and the repro: Program.cs
✔️ So rotating it 90 degree around the position (3,3) in pixel space, is rotation the square around the center of the pixel (3,3) and it seems to work as expected
img.Mutate(c => c
.Transform(new AffineTransformBuilder(TransformSpace.Pixel).AppendRotationDegrees(90, new Vector2(3, 3)))
);
✔️ So now if I want to rotate around bottom right corner of the pixel (3, 3), I can achieve this with a rotation in PixelSpace arround (3.5, 3.5) and this works well too now
img.Mutate(c => c
.Transform(new AffineTransformBuilder(TransformSpace.Pixel).AppendRotationDegrees(90, new Vector2(3, 3)))
);
🔴 And if I want to achieve the same as the first example, using the Coordinate space, I need to rotate around the coordinate (3.5, 3.5).
But it does not get me the expected result
img.Mutate(c => c
.Transform(new AffineTransformBuilder(TransformSpace.Coordinate).AppendRotationDegrees(90, new Vector2(3.5f, 3.5f)))
);
🔴 And to reproduce the 2nd example, I expect to do the rotation around the coordinate (4, 4)
But this time the pixel are shifted 1 pixel off, but the size of the image is as expected
img.Mutate(c => c
.Transform(new AffineTransformBuilder(TransformSpace.Coordinate).AppendRotationDegrees(90, new Vector2(4, 4)))
);
So, all seems good with the TransformSpace.Pixel but it seems pixel are not where expected with TransformSpace.Coordinate but the size of the image is as expected in both case
Images
No response