SixLabors / ImageSharp.Drawing

:pen: Extensions to ImageSharp containing a cross-platform 2D polygon manipulation API and drawing operations.
https://sixlabors.com/products/imagesharp-drawing/
Other
282 stars 38 forks source link

Return empty path when outline width is less than or equal to zero #225

Closed tocsoft closed 2 years ago

tocsoft commented 2 years ago

Prerequisites

Description

Updates the GenerateOutline extensions so that when an invalid width (<= 0) is specified that instead of looping it returns an EmptyPath (a new type to represent an empty path without addition allocations).

This resolves #224

codecov[bot] commented 2 years ago

Codecov Report

Merging #225 (9e2259d) into main (764f6f1) will increase coverage by 0%. The diff coverage is 61%.

@@         Coverage Diff         @@
##           main   #225   +/-   ##
===================================
  Coverage    71%    71%           
===================================
  Files        87     88    +1     
  Lines      5349   5362   +13     
  Branches   1094   1096    +2     
===================================
+ Hits       3835   3845   +10     
- Misses     1295   1298    +3     
  Partials    219    219           
Flag Coverage Δ
unittests 71% <61%> (+<1%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/ImageSharp.Drawing/Shapes/EmptyPath.cs 37% <37%> (ø)
...ImageSharp.Drawing/Shapes/OutlinePathExtensions.cs 100% <100%> (+3%) :arrow_up:
src/ImageSharp.Drawing/Shapes/Path.cs 75% <100%> (+<1%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 764f6f1...9e2259d. Read the comment docs.