PeachDrawing
PeachDrawing
ColorMatrixFilter Class
Applies a ColorMatrix to every pixel: the mechanism behind CSS grayscale(),
sepia(), saturate(), hue-rotate() and friends, including the cross-channel ones a PDF
transfer function cannot express.
public static class ColorMatrixFilter
Inheritance System.Object → ColorMatrixFilter
| Methods | |
|---|---|
| Apply(ReadOnlySpan<byte>, Span<byte>, ColorMatrix) | Transforms source into destination (the same span is allowed). The matrix works on straight (unpremultiplied) 0-1 colour, as Filter Effects 1 defines it, so pixels are unpremultiplied, transformed, clamped and premultiplied again. |
| ApplyInPlace(RasterSurface, ColorMatrix) | Applies matrix to surface in place. |
| ApplyInPlace(RasterSurface, IReadOnlyList<ColorMatrix>) | Applies matrices to surface in place, one after another, in a single pass over the pixels. Each stage’s result is clamped to the 0-1 range before the next runs, as Filter Effects 1 evaluates a filter list function by function: brightness(2) sepia(1) is not the composition of the two matrices, because the brightened channels clip at 1 before sepia mixes them. |