Skip to content

Add BlendWithCoverage overloads. Optimize Rgba32 compatible shuffling.#3150

Merged
JimBobSquarePants merged 2 commits into
mainfrom
js/porter-duff-coverage
Jul 9, 2026
Merged

Add BlendWithCoverage overloads. Optimize Rgba32 compatible shuffling.#3150
JimBobSquarePants merged 2 commits into
mainfrom
js/porter-duff-coverage

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

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 BlendWithCoverage methods to PorterDuffFunctions for Vector4, Vector256<float>, and Vector512<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.cs to verify the correctness of the new BlendWithCoverage methods. These tests cover various scenarios, including constant and span sources, varying coverage and amount arrays, and usage of working buffers.
  • Updated the ExerciseBlender helper method to include calls to the new BlendWithCoverage overloads, ensuring all blending paths are tested for expected output. [1] [2]

@JimBobSquarePants JimBobSquarePants merged commit 67aa0d3 into main Jul 9, 2026
12 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/porter-duff-coverage branch July 9, 2026 11:53
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.

1 participant