Remove Region and add new Clip Extension#150
Conversation
Codecov Report
@@ Coverage Diff @@
## master #150 +/- ##
=======================================
Coverage 69.86% 69.87%
=======================================
Files 90 88 -2
Lines 5141 5135 -6
Branches 1049 1048 -1
=======================================
- Hits 3592 3588 -4
+ Misses 1338 1337 -1
+ Partials 211 210 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor{TPixel}.cs
Show resolved
Hide resolved
src/ImageSharp.Drawing/Processing/Extensions/FillPathExtensions.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp.Drawing/Processing/Extensions/FillPathExtensions.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp.Drawing/Processing/Processors/Drawing/RecursiveImageProcessor.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp.Drawing/Processing/Processors/Drawing/RecursiveImageProcessor.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp.Drawing/Processing/Processors/Drawing/RecursiveImageProcessor.cs
Outdated
Show resolved
Hide resolved
…s.cs Co-authored-by: Scott Williams <tocsoft@gmail.com>
…s.cs Co-authored-by: Scott Williams <tocsoft@gmail.com>
…ImageProcessor.cs Co-authored-by: Scott Williams <tocsoft@gmail.com>
src/ImageSharp.Drawing/Processing/Processors/Drawing/RecursiveImageProcessor.cs
Outdated
Show resolved
Hide resolved
enable image brush to be only draw a portion of the source image
There was a problem hiding this comment.
Implementation and tests look good.
We need to clean up the terminology used in API naming and docs, because currently it feels confusing to me. The problem is that IPath can be used for many things in the Drawing library, it's name doesn't carry the purpose (which I personally dislike, but it's a common practice in drawing libraries). My recommendation is to use the term "Region" (or an equivalent unambiguously descriptive term) in parameter/property names & docs for IPath defining a region to fill, or boundary for a recursive processor.
We also need to find a better name for the new Clip method.
Update: Taking another look, I don't dislike Clip that much anymore, but I think we should still consider alternatives.
| public static IImageProcessingContext Clear( | ||
| this IImageProcessingContext source, | ||
| Color color, | ||
| IPath path) => |
There was a problem hiding this comment.
I would consider renaming path to region everywhere.
src/ImageSharp.Drawing/Processing/Extensions/ClearPathExtensions.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp.Drawing/Processing/Extensions/ClearPathExtensions.cs
Outdated
Show resolved
Hide resolved
|
|
||
| /// <summary> | ||
| /// Gets the region that this processor applies to. | ||
| /// Gets the logic path that this processor applies to. |
There was a problem hiding this comment.
| /// Gets the logic path that this processor applies to. | |
| /// Gets the <see cref="Path"/> defining the region to fill. |
| /// Gets the logic path that this processor applies to. | ||
| /// </summary> | ||
| public IPath Shape { get; } | ||
| public IPath Path { get; } |
There was a problem hiding this comment.
I think "region" is a better name when it's about filling:
| public IPath Path { get; } | |
| public IPath Region { get; } |
| /// <summary> | ||
| /// Allows the recursive application of processing operations against an image. | ||
| /// </summary> | ||
| public class RecursiveImageProcessor : IImageProcessor |
There was a problem hiding this comment.
ProcessInsideRegionProcessor?
| /// <param name="path">The target path to operate within.</param> | ||
| /// <param name="operation">The operation to perform on the source.</param> | ||
| /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> | ||
| public static IImageProcessingContext Clip( |
There was a problem hiding this comment.
I think Clip is a very generic overloaded and ambiguous name, doesn't help API discoverability in this case.
I wouldn'be afraid of going verbose here, for example ProcessInsideRegion would be a better name for this.
src/ImageSharp.Drawing/Processing/Processors/Drawing/RecursiveImageProcessor.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp.Drawing/Processing/Processors/Drawing/RecursiveImageProcessor.cs
Outdated
Show resolved
Hide resolved
…ns.cs Co-authored-by: Anton Firszov <antonfir@gmail.com>
…ns.cs Co-authored-by: Anton Firszov <antonfir@gmail.com>
…arp.Drawing into js/region-clip
|
@antonfirsov I've applied a lot of renaming and updated XML docs based on your suggestions. I found that I was straying into #94 territory though as I waded through each connected method so have stopped where I am for now. I maintained |
|
I'm merging this. We can do a final API review before RC1 |
Prerequisites
Description
Fixes #105
Regionand inheriting types.Clip(IImageProcessingContext, IPath, Action<IImageProcessingContext>)extension with functionality copied from samples