|
|
|
@ -21,6 +21,9 @@ namespace Avalonia.Media |
|
|
|
public static readonly StyledProperty<IBrush?> OpacityMaskProperty = |
|
|
|
AvaloniaProperty.Register<DrawingGroup, IBrush?>(nameof(OpacityMask)); |
|
|
|
|
|
|
|
public static readonly StyledProperty<RenderOptions?> RenderOptionsProperty = |
|
|
|
AvaloniaProperty.Register<DrawingGroup, RenderOptions?>(nameof(RenderOptions)); |
|
|
|
|
|
|
|
public static readonly DirectProperty<DrawingGroup, DrawingCollection> ChildrenProperty = |
|
|
|
AvaloniaProperty.RegisterDirect<DrawingGroup, DrawingCollection>( |
|
|
|
nameof(Children), |
|
|
|
@ -53,6 +56,12 @@ namespace Avalonia.Media |
|
|
|
set => SetValue(OpacityMaskProperty, value); |
|
|
|
} |
|
|
|
|
|
|
|
public RenderOptions? RenderOptions |
|
|
|
{ |
|
|
|
get => GetValue(RenderOptionsProperty); |
|
|
|
set => SetValue(RenderOptionsProperty, value); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the collection that contains the child geometries.
|
|
|
|
/// </summary>
|
|
|
|
@ -75,6 +84,7 @@ namespace Avalonia.Media |
|
|
|
using (context.PushOpacity(Opacity)) |
|
|
|
using (ClipGeometry != null ? context.PushGeometryClip(ClipGeometry) : default) |
|
|
|
using (OpacityMask != null ? context.PushOpacityMask(OpacityMask, bounds) : default) |
|
|
|
using (RenderOptions != null ? context.PushRenderOptions(RenderOptions.Value) : default) |
|
|
|
{ |
|
|
|
foreach (var drawing in Children) |
|
|
|
{ |
|
|
|
@ -313,6 +323,15 @@ namespace Avalonia.Media |
|
|
|
drawingGroup.Transform = new MatrixTransform(matrix); |
|
|
|
} |
|
|
|
|
|
|
|
protected override void PushRenderOptionsCore(RenderOptions renderOptions) |
|
|
|
{ |
|
|
|
// Instantiate a new drawing group and set it as the _currentDrawingGroup
|
|
|
|
var drawingGroup = PushNewDrawingGroup(); |
|
|
|
|
|
|
|
// Set the render options on the new DrawingGroup
|
|
|
|
drawingGroup.RenderOptions = renderOptions; |
|
|
|
} |
|
|
|
|
|
|
|
protected override void PopClipCore() => Pop(); |
|
|
|
|
|
|
|
protected override void PopGeometryClipCore() => Pop(); |
|
|
|
@ -323,6 +342,8 @@ namespace Avalonia.Media |
|
|
|
|
|
|
|
protected override void PopTransformCore() => Pop(); |
|
|
|
|
|
|
|
protected override void PopRenderOptionsCore() => Pop(); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a new DrawingGroup for a Push* call by setting the
|
|
|
|
/// _currentDrawingGroup to a newly instantiated DrawingGroup,
|
|
|
|
|