diff --git a/src/Avalonia.Base/Media/DrawingContext.cs b/src/Avalonia.Base/Media/DrawingContext.cs
index 5e39b0050c..9ccb730d29 100644
--- a/src/Avalonia.Base/Media/DrawingContext.cs
+++ b/src/Avalonia.Base/Media/DrawingContext.cs
@@ -451,9 +451,14 @@ namespace Avalonia.Media
}
protected abstract void PushTextOptionsCore(TextOptions textOptions);
-
+
protected abstract void PushTransformCore(Matrix matrix);
+ ///
+ /// Pushes an effect.
+ ///
+ /// The effect.
+ /// The bounds of the effect.
protected abstract void PushEffectCore(IEffect effect, Rect bounds);
protected abstract void PopClipCore();
@@ -463,6 +468,10 @@ namespace Avalonia.Media
protected abstract void PopTransformCore();
protected abstract void PopRenderOptionsCore();
protected abstract void PopTextOptionsCore();
+
+ ///
+ /// Pops an effect.
+ ///
protected abstract void PopEffectCore();
private static bool PenIsVisible(IPen? pen)
diff --git a/src/Avalonia.Base/Media/DrawingGroup.cs b/src/Avalonia.Base/Media/DrawingGroup.cs
index c76a417b87..2cab34344d 100644
--- a/src/Avalonia.Base/Media/DrawingGroup.cs
+++ b/src/Avalonia.Base/Media/DrawingGroup.cs
@@ -21,6 +21,9 @@ namespace Avalonia.Media
public static readonly StyledProperty OpacityMaskProperty =
AvaloniaProperty.Register(nameof(OpacityMask));
+ ///
+ /// Defines the property.
+ ///
public static readonly StyledProperty EffectProperty =
AvaloniaProperty.Register(nameof(Effect));
@@ -56,6 +59,9 @@ namespace Avalonia.Media
set => SetValue(OpacityMaskProperty, value);
}
+ ///
+ /// Gets or sets the effect to apply to the drawing group.
+ ///
public IEffect? Effect
{
get => GetValue(EffectProperty);
@@ -346,6 +352,7 @@ namespace Avalonia.Media
drawingGroup.TextOptions = textOptions;
}
+ ///
protected override void PushEffectCore(IEffect effect, Rect bounds)
{
// Instantiate a new drawing group and set it as the _currentDrawingGroup
@@ -369,6 +376,7 @@ namespace Avalonia.Media
protected override void PopTextOptionsCore() => Pop();
+ ///
protected override void PopEffectCore() => Pop();
///
diff --git a/src/Avalonia.Base/Media/PlatformDrawingContext.cs b/src/Avalonia.Base/Media/PlatformDrawingContext.cs
index 846c17dee5..6ebd11f7fd 100644
--- a/src/Avalonia.Base/Media/PlatformDrawingContext.cs
+++ b/src/Avalonia.Base/Media/PlatformDrawingContext.cs
@@ -88,6 +88,7 @@ internal sealed class PlatformDrawingContext : DrawingContext
protected override void PushTextOptionsCore(TextOptions textOptions) => _impl.PushTextOptions(textOptions);
+ ///
protected override void PushEffectCore(IEffect effect, Rect bounds)
{
if (_impl is IDrawingContextImplWithEffects effectImpl)
@@ -112,6 +113,7 @@ internal sealed class PlatformDrawingContext : DrawingContext
protected override void PopTextOptionsCore() => _impl.PopTextOptions();
+ ///
protected override void PopEffectCore()
{
if (_impl is IDrawingContextImplWithEffects effectImpl)
diff --git a/src/Avalonia.Base/Rendering/Composition/Drawing/Nodes/RenderDataNodes.cs b/src/Avalonia.Base/Rendering/Composition/Drawing/Nodes/RenderDataNodes.cs
index ded07e52b2..3830d9c825 100644
--- a/src/Avalonia.Base/Rendering/Composition/Drawing/Nodes/RenderDataNodes.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Drawing/Nodes/RenderDataNodes.cs
@@ -249,17 +249,29 @@ class RenderDataTextOptionsNode : RenderDataPushNode
}
}
+///
+/// A render data node that pushes an effect.
+///
class RenderDataEffectNode : RenderDataPushNode
{
+ ///
+ /// Gets or sets the effect to push.
+ ///
public IEffect? Effect { get; set; }
+
+ ///
+ /// Gets or sets the bounds of the effect.
+ ///
public Rect BoundsRect { get; set; }
+ ///
public override void Push(ref RenderDataNodeRenderContext context)
{
if (Effect != null && context.Context is IDrawingContextImplWithEffects effectImpl)
effectImpl.PushEffect(BoundsRect, Effect);
}
+ ///
public override void Pop(ref RenderDataNodeRenderContext context)
{
if (Effect != null && context.Context is IDrawingContextImplWithEffects effectImpl)
diff --git a/src/Avalonia.Base/Rendering/Composition/Drawing/RenderDataDrawingContext.cs b/src/Avalonia.Base/Rendering/Composition/Drawing/RenderDataDrawingContext.cs
index ec4d46d453..ea42fe7710 100644
--- a/src/Avalonia.Base/Rendering/Composition/Drawing/RenderDataDrawingContext.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Drawing/RenderDataDrawingContext.cs
@@ -269,6 +269,7 @@ internal class RenderDataDrawingContext : DrawingContext
TextOptions = textOptions
});
+ ///
protected override void PushEffectCore(IEffect effect, Rect bounds) => Push(new RenderDataEffectNode()
{
Effect = effect,
@@ -289,6 +290,7 @@ internal class RenderDataDrawingContext : DrawingContext
protected override void PopTextOptionsCore() => Pop();
+ ///
protected override void PopEffectCore() => Pop();
internal override void DrawBitmap(IRef? source, double opacity, Rect sourceRect, Rect destRect)