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
Setting Graphics.ImageInterpolationMode has no effect.
The following code:
var target = new Bitmap(100, 100);
using (var g = Graphics.FromImage(target))
{
g.Clear(Color.Red);
g.PixelOffsetMode = PixelOffsetMode.Half;
g.InterpolationMode = InterpolationMode.NearestNeighbor;
var bmp = new Bitmap(2, 2);
bmp.SetPixel(0, 0, Color.Black);
bmp.SetPixel(0, 1, Color.White);
bmp.SetPixel(1, 0, Color.White);
bmp.SetPixel(1, 1, Color.Black);
var destRect = new RectangleF(20, 20, 60, 60);
var srcRect = new RectangleF(0, 0, 2, 2);
g.DrawImage(bmp, destRect, srcRect, GraphicsUnit.Pixel);
}
Renders like this:
It is expect to render like this:
We are building libgdiplus from main.
The problem seems to be at the end of GdipDrawImageRectRect. It creates two surfaces, and sets an interpolation for the first of them. I can't see that that surface is used for anything. Seems to be dead code? For the second surface no interpolation filter is set. The commented out line fixes the issue:
Setting Graphics.ImageInterpolationMode has no effect.
The following code:
Renders like this:
It is expect to render like this:
We are building libgdiplus from main.
The problem seems to be at the end of GdipDrawImageRectRect. It creates two surfaces, and sets an interpolation for the first of them. I can't see that that surface is used for anything. Seems to be dead code? For the second surface no interpolation filter is set. The commented out line fixes the issue:
The text was updated successfully, but these errors were encountered: