Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

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

Description

@jhergens

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions