Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ImageBrush incorrectly offset when target region (Path or Rectangle) has a negative offset. #308

Copy link
Copy link

Description

@tocsoft
Issue body actions

Prerequisites

  • I have written a descriptive issue title
  • 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 applying a ImageBrush to a region that overlaps a negative postion the texture start drawing at the backound image edge rather than being offset.

[Theory]
[WithTestPatternImage(400, 400, PixelTypes.Rgba32)]
public void CanOffsetImage<TPixel>(TestImageProvider<TPixel> provider)
    where TPixel : unmanaged, IPixel<TPixel>
{
    byte[] data = TestFile.Create(TestImages.Png.Ducky).Bytes;
    using Image<TPixel> background = provider.GetImage();
    using Image overlay = Image.Load<Rgba32>(data);

    var brush = new ImageBrush(overlay);
    background.Mutate(c => c.Fill(brush, new RectangularPolygon(0, 0, 400, 200)));
    background.Mutate(c => c.Fill(brush, new RectangularPolygon(-100, 200, 500, 200)));

    background.DebugSave(provider, appendSourceFileOrDescription: false);
    background.CompareToReferenceOutput(provider, appendSourceFileOrDescription: false);
}

Currently produces

CanOffsetImage_Rgba32

Should produce

CanOffsetImage_Rgba32

this only effects negative offsets as postive ones work correctly

var brush = new ImageBrush(overlay);
background.Mutate(c => c.Fill(brush, new RectangularPolygon(0, 0, 400, 200)));
background.Mutate(c => c.Fill(brush, new RectangularPolygon(150, 200, 500, 200)));

CanOffsetImage_Rgba32

Reactions are currently unavailable

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.