Skip to content

Add DrawImage(Image, Point, Rectangle) method to the DrawImage processor - #2322

Merged
JimBobSquarePants merged 4 commits into
mainfrom
js/2112
Jan 23, 2023
Merged

JimBobSquarePants merged 4 commits into
mainfrom
js/2112

Conversation

@JimBobSquarePants

Copy link
Copy Markdown
Member

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

Fixes #2112

In addition to the new overloads I've refactored the extensions to make each overload call another one to reduce the amount of refactoring work required in future updates and to improve test coverage.

public static IImageProcessingContext DrawImage(
this IImageProcessingContext source,
Image image,
Rectangle rectangle,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

worth calling this sourceRectangle to make is more obvious that it's not the destination to draw to.

might be worth renaming to sourceImage too to match.

which then leads to the question should we be refering to the image we are drawing to as destinationImage/targetImage with matching targetLocation etc paramaters. i.e. properly prefixing source/destination arguments.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That might open a can of worms. I'm thinking just now about the TextOptions.Origin property in Fonts and all the PathBuilder parameters in Drawing.

I'll revisit the documentation parameters to make them super clear just now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

Comment thread tests/ImageSharp.Tests/Drawing/DrawImageTests.cs Outdated
@JimBobSquarePants
JimBobSquarePants merged commit ad094ff into main Jan 23, 2023
@JimBobSquarePants
JimBobSquarePants deleted the js/2112 branch January 23, 2023 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add DrawImage(Image, Point, Rectangle) method to the DrawImage processor

2 participants