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
When rendering an image where either the width or height of the source and destination rectangles are the same, no scaling will occur even if the rectangles differ in the other dimension.
The following code:
var bitmap = new Bitmap(100, 200);
using (var graphics = Graphics.FromImage(bitmap))
{
graphics.Clear(Color.White);
var redBitmap = new Bitmap(50, 50);
using (var redGraphics = Graphics.FromImage(redBitmap))
{
redGraphics.Clear(Color.Red);
}
var destRect = new RectangleF(25, 25, 50, 150);
var srcRect = new RectangleF(0, 0, 50, 50);
graphics.DrawImage(redBitmap, destRect, srcRect, GraphicsUnit.Pixel);
using (var pen = new Pen(Color.Black))
{
graphics.DrawRectangle(pen, Rectangle.Round(destRect));
}
}
Renders like this:
It is expected to render like this:
We are building libgdiplus from main.
It seems the problem is the following snippet in GdipDrawImageRectRect
When rendering an image where either the width or height of the source and destination rectangles are the same, no scaling will occur even if the rectangles differ in the other dimension.
The following code:
Renders like this:
It is expected to render like this:
We are building libgdiplus from main.
It seems the problem is the following snippet in GdipDrawImageRectRect
Changing && to || fixes this.
The text was updated successfully, but these errors were encountered: