Add BlendWithCoverage overloads. Optimize Rgba32 compatible shuffling.
Merged
JI
3mo ago+52697+52697+01234567890123456789012345678901234567890123456789-3473-3473-0123456789012345678901234567890123456789
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 :cop:.
- I have provided test coverage for my change (where applicable)
Description
This pull request introduces new blending functionality to support raster coverage in Porter-Duff composition operations and thoroughly tests these new methods. The main focus is on adding the BlendWithCoverage methods for different vector types and ensuring their correctness through comprehensive unit tests.
New blending functionality:
- Added
BlendWithCoveragemethods toPorterDuffFunctionsforVector4,Vector256<float>, andVector512<float>, which apply raster coverage to Porter-Duff composition results. These methods handle premultiplied alpha blending and un-premultiplication for accurate compositing.
These methods are used by ImageSharp Drawing for proper composition in the canvas.
Testing and validation:
- Added a comprehensive suite of unit tests in
PixelBlenderTests.csto verify the correctness of the newBlendWithCoveragemethods. These tests cover various scenarios, including constant and span sources, varying coverage and amount arrays, and usage of working buffers. - Updated the
ExerciseBlenderhelper method to include calls to the newBlendWithCoverageoverloads, ensuring all blending paths are tested for expected output. [1] [2]