mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added different rendering strategies for fill modes
This commit is contained in:
1 parent
3adc39c488
commit
128a656f4b
7 files changed
+1318
-47
No files matched your search
@@ -23,7 +23,6 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
|
||||
public new NoiseBrushSettings Settings { get; }
|
||||
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
// TODO: Come up with a better way to use deltaTime
|
||||
@@ -40,11 +39,11 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
return new NoiseBrushViewModel(this);
|
||||
}
|
||||
|
||||
public override void Render(SKCanvas canvas)
|
||||
public override void Render(SKCanvas canvas, SKPath path, SKPaint paint)
|
||||
{
|
||||
// Scale down the render path to avoid computing a value for every pixel
|
||||
var width = (int) (Math.Max(Layer.Bounds.Width, Layer.Bounds.Height) / Scale);
|
||||
var height = (int) (Math.Max(Layer.Bounds.Width, Layer.Bounds.Height) / Scale);
|
||||
var width = (int) (Math.Max(path.Bounds.Width, path.Bounds.Height) / Scale);
|
||||
var height = (int) (Math.Max(path.Bounds.Width, path.Bounds.Height) / Scale);
|
||||
var opacity = (float) Math.Round(Settings.Color.Alpha / 255.0, 2, MidpointRounding.AwayFromZero);
|
||||
using (var bitmap = new SKBitmap(new SKImageInfo(width, height)))
|
||||
{
|
||||
@@ -75,8 +74,8 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
}
|
||||
|
||||
using (var sh = SKShader.CreateBitmap(bitmap, SKShaderTileMode.Mirror, SKShaderTileMode.Mirror, SKMatrix.MakeScale(Scale, Scale)))
|
||||
using (var paint = new SKPaint {Shader = sh, BlendMode = Settings.BlendMode})
|
||||
{
|
||||
paint.Shader = sh;
|
||||
canvas.DrawPath(Layer.LayerShape.Path, paint);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user