using System; using Avalonia.Platform; namespace Avalonia.Rendering.SceneGraph { /// /// A node in the scene graph which represents a geometry clip push or pop. /// internal class GeometryClipNode : IDrawOperation { /// /// Initializes a new instance of the class that represents a /// geometry clip push. /// /// The clip to push. public GeometryClipNode(IGeometryImpl clip) { Clip = clip; } /// /// Initializes a new instance of the class that represents a /// geometry clip pop. /// public GeometryClipNode() { } /// public Rect Bounds => Rect.Empty; /// /// Gets the clip to be pushed or null if the operation represents a pop. /// public IGeometryImpl Clip { get; } /// public bool HitTest(Point p) => false; /// /// Determines if this draw operation equals another. /// /// The clip of the other draw operation. /// True if the draw operations are the same, otherwise false. /// /// The properties of the other draw operation are passed in as arguments to prevent /// allocation of a not-yet-constructed draw operation object. /// public bool Equals(IGeometryImpl clip) => Clip == clip; /// public void Render(IDrawingContextImpl context) { if (Clip != null) { context.PushGeometryClip(Clip); } else { context.PopGeometryClip(); } } } }