Core - Render each profile element in its own bitmap

Layer effects - Removed now redundant CreateShapeClip
This commit is contained in:
SpoinkyNL committed 2020-06-18 19:09:40 +02:00
1 parent 0903865c7d
commit 7a50249335
13 files changed
+126 -207

No files matched your search

@@ -26,8 +26,7 @@ namespace Artemis.Core.Plugins.Abstract
lock (this)
{
// Render the profile
using var paint = new SKPaint {FilterQuality = SKFilterQuality.Low};
ActiveProfile?.Render(deltaTime, canvas, canvasInfo, paint);
ActiveProfile?.Render(deltaTime, canvas, canvasInfo);
}
}
@@ -24,11 +24,6 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
internal override void InternalRender(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
{
// Move the canvas to the top-left of the render path
canvas.Translate(path.Bounds.Left, path.Bounds.Top);
// Pass the render path to the layer brush positioned at 0,0
path.Transform(SKMatrix.MakeTranslation(path.Bounds.Left * -1, path.Bounds.Top * -1));
Render(canvas, canvasInfo, path, paint);
}
@@ -99,65 +99,6 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
/// <param name="paint">The paint this layer/folder used to render</param>
public abstract void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint);
/// <summary>
/// Allows you to return a clip that is applied to the layer shape (or in case of a folder, all layer shapes in the
/// folder).
/// <para>
/// To avoid breaking other effects, use this instead of applying a clip to the entire canvas if you want to limit
/// where shapes may render
/// </para>
/// </summary>
/// <param name="renderBounds">The bounds this layer/folder rendered in</param>
/// <returns></returns>
public virtual SKPath CreateShapeClip(SKPath renderBounds)
{
return new SKPath();
}
internal void InternalPreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
{
var x = path.Bounds.Left;
var y = path.Bounds.Top;
// Move the canvas to the top-left of the render path
canvas.Translate(x, y);
// Pass the render path to the layer effect positioned at 0,0
path.Transform(SKMatrix.MakeTranslation(x * -1, y * -1));
PreProcess(canvas, canvasInfo, path, paint);
// Move the canvas back
canvas.Translate(x * -1, y * -1);
}
internal void InternalPostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
{
var x = path.Bounds.Left;
var y = path.Bounds.Top;
// Move the canvas to the top-left of the render path
canvas.Translate(x, y);
// Pass the render path to the layer effect positioned at 0,0
path.Transform(SKMatrix.MakeTranslation(x * -1, y * -1));
PostProcess(canvas, canvasInfo, path, paint);
// Move the canvas back
canvas.Translate(x * -1, y * -1);
}
internal virtual SKPath InternalCreateShapeClip(SKPath path)
{
var x = path.Bounds.Left;
var y = path.Bounds.Top;
path.Transform(SKMatrix.MakeTranslation(x * -1, y * -1));
var shapeClip = CreateShapeClip(path);
if (!shapeClip.IsEmpty)
shapeClip.Transform(SKMatrix.MakeTranslation(x, y));
return shapeClip;
}
// Not only is this needed to initialize properties on the layer effects, it also prevents implementing anything
// but LayerEffect<T> outside the core
internal abstract void Initialize(ILayerService layerService);