Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DrawImage with WrapMode.TileFlipXY sometimes renders outside destination rectangle. #731

Open
jhergens opened this issue Dec 20, 2021 · 0 comments

Comments

@jhergens
Copy link

When drawing images with image attributes having wrap mode set to WrapMode.TileFlipXY, the image is sometimes repeated outside the destination rectangle. Seems a bit random when this happens and if it is repeated for X, Y or both.

The below code:

using var backBuffer = new Bitmap(973, 560);
using (var graphics = Graphics.FromImage(backBuffer))
{
    graphics.Clear(Color.White);
    using var testImage = new Bitmap(1570, 1377);
    using (var graphics2 = Graphics.FromImage(testImage))
    {
        graphics2.Clear(Color.Red);
        using var pen = new Pen(Color.Black, 10);
        graphics2.DrawLine(pen, 0, 0, testImage.Width, testImage.Height);
        graphics2.DrawRectangle(pen, 0, 0, testImage.Width, testImage.Height);
    }

    var destRect = new Rectangle(192, 49, 486, 360);
    var imageAttributes = new ImageAttributes();
    imageAttributes.SetWrapMode(WrapMode.TileFlipXY);
    graphics.DrawImage(testImage, destRect, 0, 0, testImage.Width, testImage.Height, GraphicsUnit.Pixel, imageAttributes);
}

Results in this image:

flip_linux

Expected it to like like this (Windows):
flip_win

We are building libgdiplus from main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant