You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified that I am running the latest version of ImageSharp.Drawing
I have verified if the problem exist in both DEBUG and RELEASE mode
I have searched open and closed issues to ensure it has not already been reported
Description
When drawing a single pixel wide rectangle, the corners appear to have slightly inaccurate colours.
In this example I expect every pixel of the rectangle border to be solid red (R: 255), but some the corners are R:241 (both top corners) and R:246 (both bottom corners).
Also, relevant: coordinates pixel aligned, non-fractional, anti-aliasing off. I tried a few different blend options, but they didn't seem to make a difference either.
Steps to Reproduce
vartestImage=newImage<Rgb24>(Configuration.Default,100,100, Color.Black);varrectangle=new RectangleF(10.0f,10.0f,79,79);varpen=new Pen(Color.Red,1f);varoptions=new ShapeGraphicsOptions(){GraphicsOptions=new GraphicsOptions(){//BlendPercentage = 1,Antialias=false,//ColorBlendingMode = PixelColorBlendingMode.Normal,AntialiasSubpixelDepth=0,},};
testImage.Mutate(x => x.Draw(pen, rectangle));
testImage.Save("rectangle.png");// expected (bottom right)// 88 | 89 | 90// 88 | B | R | B// 89 | R | R | B// 90 | B | B | B// should be black
Debug.Assert(Color.Black.ToPixel<Rgb24>()==
testImage[88,88]);// BUG: these assertions SHOULD FAIL but do not// should be red (bug is that it is blended)
Debug.Assert(new Rgb24(241,0,0)== testImage[10,10]);
Debug.Assert(new Rgb24(246,0,0)== testImage[10,89]);
Debug.Assert(new Rgb24(246,0,0)== testImage[89,89]);
Debug.Assert(new Rgb24(241,0,0)== testImage[89,10]);// END BUG// should be black
Debug.Assert(Color.Black.ToPixel<Rgb24>()== testImage[90,90]);// should be red
Debug.Assert(new Rgb24(255,0,0)== testImage[11,10]);
Debug.Assert(new Rgb24(255,0,0)== testImage[11,89]);
Debug.Assert(new Rgb24(255,0,0)== testImage[88,89]);
Debug.Assert(new Rgb24(255,0,0)== testImage[88,10]);
System Configuration
ImageSharp.Drawing version: 1.0.0-beta11
Other ImageSharp packages and versions: SixLabors.ImageSharp 1.0.2
Environment (Operating system, version and so on): Win 10, x64
.NET Framework version: netcoreapp3.1, and net5.0 (5.0.100)
Additional information: I had a smoke test set up and the behavior of this bug has changed in the amount of error from true red by like 3/255 (this was producing rgb(247, 0, 0) bottom right).
Prerequisites
DEBUG
andRELEASE
modeDescription
When drawing a single pixel wide rectangle, the corners appear to have slightly inaccurate colours.
In this example I expect every pixel of the rectangle border to be solid red (R: 255), but some the corners are R:241 (both top corners) and R:246 (both bottom corners).
Also, relevant: coordinates pixel aligned, non-fractional, anti-aliasing off. I tried a few different blend options, but they didn't seem to make a difference either.
Steps to Reproduce
System Configuration
Might be related to #5 or #28.
Output image from above test:
The text was updated successfully, but these errors were encountered: