Class BlendPaint
Two paints combined pixel by pixel with a blend mode, as Skia's blend shader: Source is blended onto Destination, and the result is what this paint draws. Each part keeps its own LocalMatrix and Opacity (its blend mode, blur and dithering are not used), inside this paint's own local matrix.
public sealed record BlendPaint : Paint, ITextPaint, IEquatable<Paint>, IEquatable<BlendPaint>
- Inheritance
-
BlendPaint
- 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
BlendPaint(Paint, Paint, BlendMode)
Initializes a new instance of the BlendPaint class.
public BlendPaint(Paint destination, Paint source, BlendMode mode)
Parameters
destinationPaintThe paint underneath.
sourcePaintThe paint blended onto it.
modeBlendModeHow they combine.
Exceptions
- ArgumentNullException
A paint is null.
- ArgumentOutOfRangeException
modeis not defined.
Properties
Destination
Gets the paint underneath.
public Paint Destination { get; init; }
Property Value
Exceptions
- ArgumentNullException
The value is null.
Mode
Gets how the two combine.
public BlendMode Mode { get; init; }
Property Value
Exceptions
- ArgumentOutOfRangeException
The value is not defined.
Source
Gets the paint blended onto Destination.
public Paint Source { get; init; }
Property Value
Exceptions
- ArgumentNullException
The value is null.