| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | #ifndef LAYOUTCONTEXT_H | 
					
						
							|  |  |  |  | #define LAYOUTCONTEXT_H
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #include "property.h"
 | 
					
						
							|  |  |  |  | #include "canvas.h"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #include <list>
 | 
					
						
							|  |  |  |  | #include <map>
 | 
					
						
							|  |  |  |  | #include <set>
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace lunasvg { | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | enum class LayoutId { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  |     Symbol, | 
					
						
							|  |  |  |  |     Group, | 
					
						
							|  |  |  |  |     Shape, | 
					
						
							|  |  |  |  |     Mask, | 
					
						
							|  |  |  |  |     ClipPath, | 
					
						
							|  |  |  |  |     Marker, | 
					
						
							|  |  |  |  |     LinearGradient, | 
					
						
							|  |  |  |  |     RadialGradient, | 
					
						
							|  |  |  |  |     Pattern, | 
					
						
							|  |  |  |  |     SolidColor | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | class RenderState; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutObject { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutObject(LayoutId id); | 
					
						
							|  |  |  |  |     virtual ~LayoutObject(); | 
					
						
							|  |  |  |  |     virtual void render(RenderState&) const; | 
					
						
							|  |  |  |  |     virtual void apply(RenderState&) const; | 
					
						
							|  |  |  |  |     virtual Rect map(const Rect&) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     virtual const Rect& fillBoundingBox() const { return Rect::Invalid;} | 
					
						
							|  |  |  |  |     virtual const Rect& strokeBoundingBox() const { return Rect::Invalid;} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     bool isPaint() const { return id == LayoutId::LinearGradient || id == LayoutId::RadialGradient || id == LayoutId::Pattern || id == LayoutId::SolidColor; } | 
					
						
							|  |  |  |  |     bool isHidden() const { return isPaint() || id == LayoutId::ClipPath || id == LayoutId::Mask || id == LayoutId::Marker; } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutId id; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | using LayoutList = std::list<std::unique_ptr<LayoutObject>>; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutContainer : public LayoutObject { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutContainer(LayoutId id); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     const Rect& fillBoundingBox() const; | 
					
						
							|  |  |  |  |     const Rect& strokeBoundingBox() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     LayoutObject* addChild(std::unique_ptr<LayoutObject> child); | 
					
						
							|  |  |  |  |     LayoutObject* addChildIfNotEmpty(std::unique_ptr<LayoutContainer> child); | 
					
						
							|  |  |  |  |     void renderChildren(RenderState& state) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutList children; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | protected: | 
					
						
							|  |  |  |  |     mutable Rect m_fillBoundingBox{Rect::Invalid}; | 
					
						
							|  |  |  |  |     mutable Rect m_strokeBoundingBox{Rect::Invalid}; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutClipPath : public LayoutContainer { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutClipPath(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void apply(RenderState& state) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     Units units; | 
					
						
							|  |  |  |  |     Transform transform; | 
					
						
							|  |  |  |  |     const LayoutClipPath* clipper; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutMask : public LayoutContainer { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutMask(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void apply(RenderState& state) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     double x; | 
					
						
							|  |  |  |  |     double y; | 
					
						
							|  |  |  |  |     double width; | 
					
						
							|  |  |  |  |     double height; | 
					
						
							|  |  |  |  |     Units units; | 
					
						
							|  |  |  |  |     Units contentUnits; | 
					
						
							|  |  |  |  |     double opacity; | 
					
						
							|  |  |  |  |     const LayoutMask* masker; | 
					
						
							|  |  |  |  |     const LayoutClipPath* clipper; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutSymbol : public LayoutContainer { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutSymbol(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void render(RenderState& state) const; | 
					
						
							|  |  |  |  |     Rect map(const Rect& rect) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     double width; | 
					
						
							|  |  |  |  |     double height; | 
					
						
							|  |  |  |  |     Transform transform; | 
					
						
							|  |  |  |  |     Rect clip; | 
					
						
							|  |  |  |  |     double opacity; | 
					
						
							|  |  |  |  |     const LayoutMask* masker; | 
					
						
							|  |  |  |  |     const LayoutClipPath* clipper; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutGroup : public LayoutContainer { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutGroup(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void render(RenderState& state) const; | 
					
						
							|  |  |  |  |     Rect map(const Rect& rect) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     Transform transform; | 
					
						
							|  |  |  |  |     double opacity; | 
					
						
							|  |  |  |  |     const LayoutMask* masker; | 
					
						
							|  |  |  |  |     const LayoutClipPath* clipper; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutMarker : public LayoutContainer { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutMarker(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     Transform markerTransform(const Point& origin, double angle, double strokeWidth) const; | 
					
						
							|  |  |  |  |     Rect markerBoundingBox(const Point& origin, double angle, double strokeWidth) const; | 
					
						
							|  |  |  |  |     void renderMarker(RenderState& state, const Point& origin, double angle, double strokeWidth) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     double refX; | 
					
						
							|  |  |  |  |     double refY; | 
					
						
							|  |  |  |  |     Transform transform; | 
					
						
							|  |  |  |  |     Angle orient; | 
					
						
							|  |  |  |  |     MarkerUnits units; | 
					
						
							|  |  |  |  |     Rect clip; | 
					
						
							|  |  |  |  |     double opacity; | 
					
						
							|  |  |  |  |     const LayoutMask* masker; | 
					
						
							|  |  |  |  |     const LayoutClipPath* clipper; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutPattern : public LayoutContainer { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutPattern(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void apply(RenderState& state) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     double x; | 
					
						
							|  |  |  |  |     double y; | 
					
						
							|  |  |  |  |     double width; | 
					
						
							|  |  |  |  |     double height; | 
					
						
							|  |  |  |  |     Transform transform; | 
					
						
							|  |  |  |  |     Units units; | 
					
						
							|  |  |  |  |     Units contentUnits; | 
					
						
							|  |  |  |  |     Rect viewBox; | 
					
						
							|  |  |  |  |     PreserveAspectRatio preserveAspectRatio; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutGradient : public LayoutObject { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutGradient(LayoutId id); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     Transform transform; | 
					
						
							|  |  |  |  |     SpreadMethod spreadMethod; | 
					
						
							|  |  |  |  |     Units units; | 
					
						
							|  |  |  |  |     GradientStops stops; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutLinearGradient : public LayoutGradient { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutLinearGradient(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void apply(RenderState& state) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     double x1; | 
					
						
							|  |  |  |  |     double y1; | 
					
						
							|  |  |  |  |     double x2; | 
					
						
							|  |  |  |  |     double y2; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutRadialGradient : public LayoutGradient { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutRadialGradient(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void apply(RenderState& state) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     double cx; | 
					
						
							|  |  |  |  |     double cy; | 
					
						
							|  |  |  |  |     double r; | 
					
						
							|  |  |  |  |     double fx; | 
					
						
							|  |  |  |  |     double fy; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutSolidColor : public LayoutObject { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutSolidColor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void apply(RenderState& state) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     Color color; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class FillData { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     FillData() = default; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void fill(RenderState& state, const Path& path) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     const LayoutObject* painter{nullptr}; | 
					
						
							|  |  |  |  |     Color color{Color::Transparent}; | 
					
						
							|  |  |  |  |     double opacity{0}; | 
					
						
							|  |  |  |  |     WindRule fillRule{WindRule::NonZero}; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class StrokeData { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     StrokeData() = default; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void stroke(RenderState& state, const Path& path) const; | 
					
						
							|  |  |  |  |     void inflate(Rect& box) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     const LayoutObject* painter{nullptr}; | 
					
						
							|  |  |  |  |     Color color{Color::Transparent}; | 
					
						
							|  |  |  |  |     double opacity{0}; | 
					
						
							|  |  |  |  |     double width{1}; | 
					
						
							|  |  |  |  |     double miterlimit{4}; | 
					
						
							|  |  |  |  |     LineCap cap{LineCap::Butt}; | 
					
						
							|  |  |  |  |     LineJoin join{LineJoin::Miter}; | 
					
						
							|  |  |  |  |     DashData dash; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class MarkerPosition { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     MarkerPosition(const LayoutMarker* marker, const Point& origin, double angle); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     const LayoutMarker* marker; | 
					
						
							|  |  |  |  |     Point origin; | 
					
						
							|  |  |  |  |     double angle; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | using MarkerPositionList = std::vector<MarkerPosition>; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class MarkerData { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     MarkerData() = default; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void add(const LayoutMarker* marker, const Point& origin, double angle); | 
					
						
							|  |  |  |  |     void render(RenderState& state) const; | 
					
						
							|  |  |  |  |     void inflate(Rect& box) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     MarkerPositionList positions; | 
					
						
							|  |  |  |  |     double strokeWidth{1}; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutShape : public LayoutObject { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutShape(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void render(RenderState& state) const; | 
					
						
							|  |  |  |  |     Rect map(const Rect& rect) const; | 
					
						
							|  |  |  |  |     const Rect& fillBoundingBox() const; | 
					
						
							|  |  |  |  |     const Rect& strokeBoundingBox() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     Path path; | 
					
						
							|  |  |  |  |     Transform transform; | 
					
						
							|  |  |  |  |     FillData fillData; | 
					
						
							|  |  |  |  |     StrokeData strokeData; | 
					
						
							|  |  |  |  |     MarkerData markerData; | 
					
						
							|  |  |  |  |     Visibility visibility; | 
					
						
							|  |  |  |  |     WindRule clipRule; | 
					
						
							|  |  |  |  |     double opacity; | 
					
						
							|  |  |  |  |     const LayoutMask* masker; | 
					
						
							|  |  |  |  |     const LayoutClipPath* clipper; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							|  |  |  |  |     mutable Rect m_fillBoundingBox{Rect::Invalid}; | 
					
						
							|  |  |  |  |     mutable Rect m_strokeBoundingBox{Rect::Invalid}; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | enum class RenderMode { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  |     Display, | 
					
						
							|  |  |  |  |     Clipping | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | struct BlendInfo { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  |     const LayoutClipPath* clipper; | 
					
						
							|  |  |  |  |     const LayoutMask* masker; | 
					
						
							|  |  |  |  |     double opacity; | 
					
						
							|  |  |  |  |     Rect clip; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class RenderState { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     RenderState(const LayoutObject* object, RenderMode mode); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void beginGroup(RenderState& state, const BlendInfo& info); | 
					
						
							|  |  |  |  |     void endGroup(RenderState& state, const BlendInfo& info); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     const LayoutObject* object() const { return m_object;} | 
					
						
							|  |  |  |  |     RenderMode mode() const { return m_mode; } | 
					
						
							|  |  |  |  |     const Rect& objectBoundingBox() const { return m_object->fillBoundingBox(); } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     std::shared_ptr<Canvas> canvas; | 
					
						
							|  |  |  |  |     Transform transform; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							|  |  |  |  |     const LayoutObject* m_object; | 
					
						
							|  |  |  |  |     RenderMode m_mode; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-16 10:31:43 +00:00
										 |  |  |  | class TreeBuilder; | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | class StyledElement; | 
					
						
							|  |  |  |  | class GeometryElement; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutContext { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							| 
									
										
										
										
											2022-10-16 10:31:43 +00:00
										 |  |  |  |     LayoutContext(const TreeBuilder* builder, LayoutSymbol* root); | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     Element* getElementById(const std::string& id) const; | 
					
						
							|  |  |  |  |     LayoutObject* getResourcesById(const std::string& id) const; | 
					
						
							|  |  |  |  |     LayoutObject* addToResourcesCache(const std::string& id, std::unique_ptr<LayoutObject> resources); | 
					
						
							|  |  |  |  |     LayoutMask* getMasker(const std::string& id); | 
					
						
							|  |  |  |  |     LayoutClipPath* getClipper(const std::string& id); | 
					
						
							|  |  |  |  |     LayoutMarker* getMarker(const std::string& id); | 
					
						
							|  |  |  |  |     LayoutObject* getPainter(const std::string& id); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     FillData fillData(const StyledElement* element); | 
					
						
							|  |  |  |  |     DashData dashData(const StyledElement* element); | 
					
						
							|  |  |  |  |     StrokeData strokeData(const StyledElement* element); | 
					
						
							|  |  |  |  |     MarkerData markerData(const GeometryElement* element, const Path& path); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     void addReference(const Element* element); | 
					
						
							|  |  |  |  |     void removeReference(const Element* element); | 
					
						
							|  |  |  |  |     bool hasReference(const Element* element) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-10-16 10:31:43 +00:00
										 |  |  |  |     const TreeBuilder* m_builder; | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  |     LayoutSymbol* m_root; | 
					
						
							|  |  |  |  |     std::map<std::string, LayoutObject*> m_resourcesCache; | 
					
						
							|  |  |  |  |     std::set<const Element*> m_references; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 10:37:05 +00:00
										 |  |  |  | class LayoutBreaker { | 
					
						
							| 
									
										
										
										
											2022-10-03 16:25:42 +00:00
										 |  |  |  | public: | 
					
						
							|  |  |  |  |     LayoutBreaker(LayoutContext* context, const Element* element); | 
					
						
							|  |  |  |  |     ~LayoutBreaker(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							|  |  |  |  |     LayoutContext* m_context; | 
					
						
							|  |  |  |  |     const Element* m_element; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } // namespace lunasvg
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #endif // LAYOUTCONTEXT_H
 |