Class ColorMatrixPaint
Another paint with a color matrix run on its colors, as Skia's color-filtered shader: each color, unpremultiplied, goes through the matrix, is clamped to 0 to 1 and is premultiplied again. WithColorMatrix(ColorMatrix) makes one.
public sealed record ColorMatrixPaint : Paint, ITextPaint, IEquatable<Paint>, IEquatable<ColorMatrixPaint>
- Inheritance
-
ColorMatrixPaint
- Implements
- Inherited Members
Examples
LinearGradient sky = new(new Vector2(0, 0), new Vector2(0, 100), new RgbaF32(0.2f, 0.4f, 0.9f, 1), new RgbaF32(0.9f, 0.6f, 0.4f, 1));
NoisePaint clouds = NoisePaint.Fractal(0.02f, 0.05f, 4, seed: 3);
// Noise multiplied onto the gradient, then the whole paint turned to sepia.
Paint paint = new BlendPaint(sky, clouds, BlendMode.SoftLight).WithColorMatrix(ColorMatrix.Sepia(0.6f));
using (RasterCanvas<Rgba8> canvas = raster.CreateCanvas())
{
canvas.DrawPaint(paint);
}
Constructors
ColorMatrixPaint(Paint, ColorMatrix)
Initializes a new instance of the ColorMatrixPaint class.
public ColorMatrixPaint(Paint source, ColorMatrix matrix)
Parameters
sourcePaintThe paint whose colors are changed; its blend mode, blur and dithering are not used.
matrixColorMatrixThe matrix.
Exceptions
- ArgumentNullException
sourceis null.
Properties
Matrix
Gets the matrix.
public ColorMatrix Matrix { get; init; }
Property Value
Source
Gets the paint whose colors are changed.
public Paint Source { get; init; }
Property Value
Exceptions
- ArgumentNullException
The value is null.