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

Add SolidBrush<TPixel> to paint a pixel value #166

Closed calrsom closed 2 years ago

calrsom commented 3 years ago

Prerequisites

Description

Implemented a variation of SolidBrush that takes color as TPixel rather than Color. This allows for painting that uses full precision of RgbaVector and other floating-point pixel formats.

CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

codecov[bot] commented 3 years ago

Codecov Report

Merging #166 (30b6e95) into master (7ffae70) will decrease coverage by 0.03%. The diff coverage is 83.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #166      +/-   ##
==========================================
- Coverage   70.03%   69.99%   -0.04%     
==========================================
  Files          89       89              
  Lines        5209     5216       +7     
  Branches     1062     1063       +1     
==========================================
+ Hits         3648     3651       +3     
- Misses       1347     1350       +3     
- Partials      214      215       +1     
Flag Coverage Δ
unittests 69.99% <83.78%> (-0.04%) :arrow_down:

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

Impacted Files Coverage Δ
src/ImageSharp.Drawing/Processing/SolidBrush.cs 85.36% <83.78%> (-8.76%) :arrow_down:

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 7ffae70...30b6e95. Read the comment docs.

JimBobSquarePants commented 2 years ago

Thanks for this, I'll get it reviewed asap.

JimBobSquarePants commented 2 years ago

Note: Please don't merge this yet until we've had further discussion

calrsom commented 2 years ago

I believe this is handled better by https://github.com/SixLabors/ImageSharp/pull/1801. Also, I ended up needing to further customize the blending math and created a custom IBrush implementation, specific to my custom pixel type.