//////////////////////////////////////////////////////////////////////////////////////////////////// // NoesisGUI - http://www.noesisengine.com // Copyright (c) 2013 Noesis Technologies S.L. All Rights Reserved. //////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef __GUI_PATHGEOMETRY_H__ #define __GUI_PATHGEOMETRY_H__ #include #include #include #include #include #include namespace Noesis { struct NotifyCollectionChangedEventArgs; class PathFigure; template class FreezableCollection; typedef FreezableCollection PathFigureCollection; NS_WARNING_PUSH NS_MSVC_WARNING_DISABLE(4251 4275) //////////////////////////////////////////////////////////////////////////////////////////////////// /// Represents a complex shape that may be composed of arcs, curves, ellipses, lines and rectangles. /// /// .. code-block:: xml /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.pathgeometry //////////////////////////////////////////////////////////////////////////////////////////////////// class NS_GUI_CORE_API PathGeometry: public Geometry { public: PathGeometry(); /// Gets or sets the collection of PathFigure objects that describe the path's contents //@{ PathFigureCollection* GetFigures() const; void SetFigures(PathFigureCollection* figures); //@} /// Gets or sets a value that determines how the intersecting areas contained in this /// PathGeometry are combined //@{ FillRule GetFillRule() const; void SetFillRule(FillRule rule); //@} /// From Geometry //@{ bool IsEmpty() const override; //@} // Hides Freezable methods for convenience //@{ Ptr Clone() const; Ptr CloneCurrentValue() const; //@} /// From BaseObject //@{ String ToString() const override; //@} /// From IRenderProxyCreator //@{ void CreateRenderProxy(RenderTreeUpdater& updater, uint32_t proxyIndex) override; void UpdateRenderProxy(RenderTreeUpdater& updater, uint32_t proxyIndex) override; //@} public: /// Dependency property static const DependencyProperty* FiguresProperty; static const DependencyProperty* FillRuleProperty; protected: /// From Freezable //@{ void CloneCommonCore(const Freezable* source) override; Ptr CreateInstanceCore() const override; //@} /// From Geometry //@{ Rect GetRenderBoundsOverride(Pen* pen) const override; bool FillContainsOverride(const Point& point) const override; bool StrokeContainsOverride(Pen* pen, const Point& point) const override; //@} private: friend class PathFigure; void InvalidatePath(); void InvalidateFillRule(FillRule fillRule); bool IsDirty() const; void BuildPath() const; void OnFiguresCollectionChanged(BaseComponent* s, const NotifyCollectionChangedEventArgs& e); private: enum UpdateFlags { UpdateFlags_Path = Geometry::UpdateFlags_Sentinel, UpdateFlags_FillRule }; mutable SVGPath mPath; mutable Rect mBounds; NS_DECLARE_REFLECTION(PathGeometry, Geometry) }; NS_WARNING_POP } #endif