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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle case when Foreground image overhangs bottom of background image during DrawImage Call (3.1 target) #2610

Merged
merged 4 commits into from Dec 10, 2023

Conversation

tocsoft
Copy link
Member

@tocsoft tocsoft commented Dec 8, 2023

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 馃懏.
  • I have provided test coverage for my change (where applicable)

Description

Prevents the ArgumentOutOfRangeException when the area of interest of the foreground image will be drawn past the edge of the bounds of the background image.

fixes #2603
related to #2609

Targeting 3.1 release branch

@tocsoft tocsoft force-pushed the issue/2603 branch 2 times, most recently from 9cced1a to ec55081 Compare December 8, 2023 15:59
@JimBobSquarePants
Copy link
Member

Thanks for fixing this.

We'll need to PR this against release/v3.1.x here also as well as update the ImageBrush to allow negative offsetting since it does the same thing.

@tocsoft
Copy link
Member Author

tocsoft commented Dec 8, 2023

馃憤 i'll rebaseline the PRs against the 3.1 branch this weekend.

Regarding ImageBrush I was just looking over the code and I don't see how that would effected by these issues at all, this one is about the final blending stage and that's handled differently over there, and the other doesn't makes sense for textures either... I'm fairly sure that these changes should only effect the explicit DrawImage api.

@JimBobSquarePants
Copy link
Member

Thanks, appreciate it. See here for what I mean with the ImageBrush. It does the same reset of the position when given negative location. That鈥檚 why I exposed the rectangle constructor.

SixLabors/ImageSharp.Drawing#305

@tocsoft tocsoft changed the base branch from main to release/3.1.x December 9, 2023 10:32
@tocsoft tocsoft changed the title Handle case when Foreground image overhangs bottom of background image during DrawImage Call Handle case when Foreground image overhangs bottom of background image during DrawImage Call (3.1 target) Dec 9, 2023
@tocsoft
Copy link
Member Author

tocsoft commented Dec 9, 2023

managed to reduce it to a single pair of clamping operations to solve the ArgumentOutOfRange exception.

Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work here!

@tocsoft tocsoft merged commit 6863127 into release/3.1.x Dec 10, 2023
8 checks passed
@tocsoft tocsoft deleted the issue/2603 branch December 10, 2023 10:16
@tocsoft tocsoft mentioned this pull request Dec 10, 2023
4 tasks
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

Successfully merging this pull request may close these issues.

Calling DrawImage with top image that overhangs bottom image in Y direction fails with exception
3 participants