12public sealed partial class RenderSurfaceHost<TBackbuffer>
13 where TBackbuffer : BackbufferBase
15 private void BeginViewportClip(View view, Rectangle viewport, BackbufferBase target)
18 target.
Canvas.ResetMatrix();
19 target.
Canvas.ClipRect(viewport.ToSKRect(), SKClipOperation.Intersect, antialias:
false);
21 foreach (var blocker
in ViewManager.GetViewsAbove(view))
23 if (!blocker.BlocksViewsBelow)
26 var overlap =
Rectangle.Intersect(viewport, blocker.GetRenderViewportTargetRectPx());
29 target.
Canvas.ClipRect(overlap.ToSKRect(), SKClipOperation.Difference, antialias:
false);
33 private int BeginPresentation(
38 BackbufferBase? destination =
null)
41 opacity = Math.Clamp(opacity, 0f, 1f);
42 reveal = Math.Clamp(reveal, 0f, 1f);
44 if (opacity <= 0.0001f || reveal <= 0.0001f || bounds.IsEmpty)
52 RectangleF revealRect = EffectGeometry.GetRevealRect(bounds, direction, reveal);
54 target.Canvas.ClipRect(
55 revealRect.ToSKRect(),
56 SKClipOperation.Intersect,
60 if (opacity < 0.9999f)
62 using var paint =
new SKPaint
68 (
byte)Math.Round(opacity * 255f))
71 target.Canvas.SaveLayer(bounds.ToSKRect(), paint);
78 private void EndPresentation(
int saveCount, BackbufferBase? destination =
null)
82 while (saveCount-- > 0)
83 target.Canvas.Restore();
86 private static RectangleF GetLayerPresentationBounds(View view, SceneLayer layer)
88 RectangleF viewport = view.GetRenderViewportTargetRectPx();
89 PointF offset = view.GetEffectOffsetPx(layer);
91 return new RectangleF(
92 viewport.Left + offset.X,
93 viewport.Top + offset.Y,
98 private void InvokePostSceneCanvasHooks(BackbufferBase? destination =
null)
101 var hasSurfaceHandlers = RenderBackbufferPostScene is not
null;
102 var hasPlugins = EnginePluginRegistry.All.Count > 0;
104 if (!hasSurfaceHandlers && !hasPlugins)
107 if (!target.IsGlThreadRendered)
108 target.AddToBackbufferDirtyRectangle(
115 if (hasSurfaceHandlers)
116 RenderBackbufferPostScene?.Invoke(target.Canvas);
119 EnginePluginRegistry.InvokePostRenderCanvas(Engine.Instance,
this, target.Canvas);
SKCanvas Canvas
Gets the SkiaSharp canvas used for drawing operations on this backbuffer.
@ Rectangle
Particles are spawned uniformly within a rectangular area. This is the default distribution.
EffectDirection
Specifies the direction in which a directional display effect travels.