40 #include <boost/noncopyable.hpp>
42 namespace cinder {
namespace svg {
47 typedef enum {
WEIGHT_100,
WEIGHT_200,
WEIGHT_300,
WEIGHT_400,
WEIGHT_NORMAL =
WEIGHT_400,
WEIGHT_500,
WEIGHT_600,
WEIGHT_700,
WEIGHT_BOLD =
WEIGHT_700,
WEIGHT_800,
WEIGHT_900 }
FontWeight;
63 typedef std::function<bool(const Node&, svg::Style *)>
RenderVisitor;
120 std::shared_ptr<std::function<bool(const Node&, svg::Style *)> >
mVisitor;
133 float asUser(
float percentOf = 100,
float dpi = 72,
float fontSize = 12,
float fontXHeight = 7 )
const;
173 std::vector<std::pair<float,ColorA8u> >
mStops;
309 static Paint sPaintNone, sPaintBlack;
425 void firstStartRender(
Renderer &renderer )
const;
693 const std::shared_ptr<Font>
getFont()
const;
705 mutable std::shared_ptr<Font>
mFont;
706 mutable std::shared_ptr<std::vector<std::pair<uint16_t,Vec2f> > >
mGlyphMeasures;
784 Doc(
const fs::path &filePath );
809 std::shared_ptr<Surface8u>
loadImage( fs::path relativePath );
813 virtual void renderSelf(
Renderer &renderer )
const;
815 std::shared_ptr<XmlTree> mXmlTree;
816 std::map<fs::path,std::shared_ptr<Surface8u> > mImageCache;
820 int32_t mWidth, mHeight;
843 virtual const char*
what()
const throw() {
return mMessage; }
Paint mStroke
Definition: Svg.h:289
static bool parseTransformComponent(const char **c, MatrixAffine2f *result)
Definition: Svg.cpp:800
Line(const Node *parent)
Definition: Svg.h:556
bool mUseObjectBoundingBox
Definition: Svg.h:177
Circle(const Node *parent)
Definition: Svg.h:493
virtual Shape2d getShape() const
Returns a Shape2d representing the node in local coordinates. Not supported for Text.
Definition: Svg.h:365
void setFontWeight(FontWeight weight)
Definition: Svg.h:265
SVG Style for a node. Corresponds to SVG Styling: http://www.w3.org/TR/SVG/styling.html.
Definition: Svg.h:183
float mOpacity
Definition: Svg.h:442
bool mSpecifiesTransform
Definition: Svg.h:459
const Rectf & getRect() const
Definition: Svg.h:653
bool mSpecifiesFillOpacity
Definition: Svg.h:285
virtual ~Node()
Definition: Svg.h:316
Represents a group of SVG elements. http://www.w3.org/TR/SVG/struct.html#Groups.
Definition: Svg.h:731
SVG Text element. http://www.w3.org/TR/SVG/text.html#TextElement.
Definition: Svg.h:715
std::vector< Value > mRotate
Definition: Svg.h:684
Group(const Node *parent)
Definition: Svg.h:733
GLsizei GLsizei GLchar * source
Definition: GLee.h:2361
void appendShape2d(Shape2d *appendTo) const
Definition: Svg.cpp:1486
SVG Circle element: http://www.w3.org/TR/SVG/shapes.html#CircleElement.
Definition: Svg.h:491
Paint findPaintInAncestors(const std::string &paintName) const
Finds the svg::Paint node with ID elementId amongst this Node's ancestors. Returns a default svg::Pai...
Definition: Svg.cpp:958
virtual void popFillOpacity()
Definition: Svg.h:95
SVG Value/Unit pair.
Definition: Svg.h:126
float mStrokeWidth
Definition: Svg.h:291
bool containsPoint(const Vec2f &pt) const
Returns whether the point pt is inside of the Node's shape.
Definition: Svg.cpp:1166
std::shared_ptr< Surface8u > loadImage(fs::path relativePath)
Utility function to load an image relative to the document. Caches results.
Definition: Svg.cpp:2244
bool mSpecifiesStrokeOpacity
Definition: Svg.h:285
float getOpacity() const
Definition: Svg.h:207
virtual Shape2d getShape() const
Returns a Shape2d representing the node in local coordinates. Not supported for Text.
Definition: Svg.cpp:1143
const Node * findNode(const std::string &id, bool recurse=true) const
Recursively searches for a child element named id. Returns NULL on failure.
Definition: Svg.cpp:1717
virtual bool containsPoint(const Vec2f &pt) const
Returns whether the point pt is inside of the Node's shape.
Definition: Svg.h:619
virtual ~Renderer()
Definition: Svg.h:70
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1623
virtual void popGroup()
Definition: Svg.h:75
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1493
virtual const Node * findInAncestors(const std::string &elementId) const
Finds the node with ID elementId amongst this Node's ancestors. Returns NULL on failure.
Definition: Svg.cpp:1775
virtual Shape2d getShape() const
Returns the merged Shape2d for all children of the group.
Definition: Svg.h:754
bool mUseObjectBoundingBox
Definition: Svg.h:458
virtual Rectf calcBoundingBox() const
Definition: Svg.h:641
Polyline(const Node *parent)
Definition: Svg.h:613
Shape2d transformCopy(const MatrixAffine2f &matrix) const
Returns a copy transformed by matrix.
Definition: Shape2d.cpp:87
bool mSpecifiesFontWeight
Definition: Svg.h:300
void unspecifyStrokeWidth()
Definition: Svg.h:224
void setStrokeWidth(float strokeWidth)
Definition: Svg.h:226
void unspecifyFill()
Definition: Svg.h:194
bool mSpecifiesOpacity
Definition: Svg.h:283
std::shared_ptr< Doc > DocRef
Definition: Svg.h:779
bool mSpecifiesStrokeWidth
Definition: Svg.h:290
virtual bool containsPoint(const Vec2f &pt) const
Returns whether the point pt is inside of the Node's shape.
Definition: Svg.h:542
bool mSpecifiesVisible
Definition: Svg.h:306
virtual void pushTextRotation(float rotation)
Definition: Svg.h:108
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1546
virtual void pushTextPen(const Vec2f &penPos)
Definition: Svg.h:106
GLsizei const GLchar ** string
Definition: GLee.h:2427
Node(const Node *parent)
Definition: Svg.h:315
Style calcInheritedStyle() const
Returns the node's Style, including attributes inherited from its ancestors for attributes it does no...
Definition: Svg.cpp:899
bool mIgnoreAttributes
Definition: Svg.h:702
Vec2f getCoords0() const
Definition: Svg.h:165
float getOffset(size_t idx) const
Definition: Svg.h:161
float mRadius
Definition: Svg.h:487
std::vector< Value > mY
Definition: Svg.h:682
virtual void pushMatrix(const MatrixAffine2f &m)
Definition: Svg.h:86
Vec2f mPoint1
Definition: Svg.h:568
Node * nodeUnderPoint(const Vec2f &pt)
Returns the top-most Node which contains pt. Returns NULL if no Node contains the point...
Definition: Svg.cpp:2267
void setFillOpacity(float fillOpacity)
Definition: Svg.h:220
bool specifiesFontFamilies() const
Definition: Svg.h:248
virtual bool isDrawable() const
Definition: Svg.h:473
bool mBoundingBoxCached
Definition: Svg.h:421
std::vector< std::string > & getFontFamilies()
Definition: Svg.h:251
Doc()
Definition: Svg.h:783
Ellipse(const Node *parent)
Definition: Svg.h:514
virtual void drawEllipse(const svg::Ellipse &ellipse)
Definition: Svg.h:82
const Node & operator/(const std::string &id) const
Returns a reference to the child named id. Throws svg::ExcChildNotFound if not found.
Definition: Svg.h:751
static Style makeGlobalDefaults()
Returns a Style set appropriately for global defaults.
Definition: Svg.cpp:288
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1814
GLenum GLsizei width
Definition: GLee.h:969
virtual void popStrokeOpacity()
Definition: Svg.h:97
virtual void renderSelf(Renderer &renderer) const =0
FillRule getFillRule() const
Definition: Svg.h:231
void setStyle(const Style &style)
Sets the style defined on this Node but not inherited from ancestors.
Definition: Svg.h:329
static const Paint & getStrokeDefault()
Definition: Svg.h:203
virtual Shape2d getShape() const
Returns a Shape2d representing the node in local coordinates. Not supported for Text.
Definition: Svg.cpp:1514
virtual bool containsPoint(const Vec2f &pt) const
Returns whether the point pt is inside of the Node's shape.
Definition: Svg.h:334
std::vector< std::pair< float, ColorA8u > > mStops
Definition: Svg.h:173
const Node * mParent
Definition: Svg.h:416
float getRotation() const
Definition: Svg.cpp:1970
virtual void drawPolyline(const svg::Polyline &polyline)
Definition: Svg.h:77
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1929
PolyLine2f & getPolyLine()
Definition: Svg.h:617
MatrixAffine2f getTransform() const
Definition: Svg.h:170
LineJoin getLineJoin() const
Returns node's line join, or the first among its ancestors when it has none.
Definition: Svg.cpp:694
Shape2d getMergedShape2d() const
Definition: Svg.cpp:1797
virtual void pushFillOpacity(float opacity)
Definition: Svg.h:94
FontWeight mFontWeight
Definition: Svg.h:303
void appendMergedShape2d(Shape2d *appendTo) const
Appends the merged Shape2d for the group to appentTo.
Definition: Svg.cpp:1804
RectT transformCopy(const class MatrixAffine2< T > &matrix) const
Returns a copy of the Rect transformed by matrix. Represents the bounding box of the transformed Rect...
Definition: Rect.cpp:202
std::vector< TextSpanRef > mSpans
Definition: Svg.h:727
std::shared_ptr< Font > mFont
Definition: Svg.h:705
void parse(const XmlTree &xml)
Definition: Svg.cpp:1111
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.h:450
void clear()
Marks all styles as unspecified.
Definition: Svg.cpp:312
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:1011
float getStrokeOpacity() const
Returns node's stroke opacity, or the first among its ancestors when it has none. ...
Definition: Svg.cpp:673
virtual Shape2d getShape() const
Returns a Shape2d representing the node in local coordinates. Not supported for Text.
Definition: Svg.cpp:1173
float getRotation() const
Definition: Svg.cpp:2123
void setDisplayNone(bool displayNone)
Definition: Svg.h:274
std::vector< std::pair< uint16_t, Vec2f > > getGlyphMeasures() const
Returns a vector of glyph IDs and positions for the string, ignoring rotation. Cached and lazily calc...
Definition: Svg.cpp:2037
T x
Definition: Vector.h:71
static Paint parse(const char *value, bool *specified, const Node *parentNode)
Definition: Svg.cpp:203
bool mSpecifiesTransform
Definition: Svg.h:179
SVG Polyline Element: http://www.w3.org/TR/SVG/shapes.html#PolylineElement.
Definition: Svg.h:611
MatrixAffine2f getTransformAbsolute() const
Returns the absolute transformation of this node, which includes inherited transformations.
Definition: Svg.cpp:976
Vec2f getCenter() const
Definition: Svg.h:517
void unspecifyStrokeOpacity()
Definition: Svg.h:212
float mStrokeOpacity
Definition: Svg.h:286
LineCap getLineCap() const
Returns node's line cap, or the first among its ancestors when it has none.
Definition: Svg.cpp:687
virtual Rectf calcBoundingBox() const
Definition: Svg.h:660
void parse(const XmlTree &xml)
Definition: Svg.cpp:1656
LineJoin
Definition: Svg.h:46
void parse(const Node *parent, const XmlTree &xml)
Definition: Svg.cpp:1002
void unspecifyVisible()
Definition: Svg.h:271
SVG Ellipse element: http://www.w3.org/TR/SVG/shapes.html#EllipseElement.
Definition: Svg.h:512
Paint asPaint() const
Definition: Svg.cpp:1120
virtual void pushGroup(const Group &group, float opacity)
Definition: Svg.h:74
bool mDisplayNone
Definition: Svg.h:306
static Value getFontSizeDefault()
Definition: Svg.h:260
float getFillOpacity() const
Definition: Svg.h:219
bool isLinearGradient() const
Definition: Svg.h:158
std::shared_ptr< TextSpan > TextSpanRef
Definition: Svg.h:669
float getStrokeWidth() const
Returns node's stroke width, or the first among its ancestors when it has none.
Definition: Svg.cpp:652
virtual bool isDrawable() const
Definition: Svg.h:486
bool isDisplayNone() const
Returns whether the Display property of this Node is set to 'None', preventing rendering of the node ...
Definition: Svg.h:394
FontWeight getFontWeight() const
Definition: Svg.h:264
void setFontFamilies(const std::vector< std::string > &families)
Definition: Svg.h:253
bool specifiesFillOpacity() const
Definition: Svg.h:217
bool mSpecifiesTransform
Definition: Svg.h:419
Vec2f getCoords1() const
Definition: Svg.h:166
static float getStrokeWidthDefault()
Definition: Svg.h:227
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: GLee.h:1023
float mDx
Definition: Svg.h:683
static float getFillOpacityDefault()
Definition: Svg.h:221
static LineJoin getLineJoinDefault()
Definition: Svg.h:245
std::shared_ptr< Group > mDefs
Definition: Svg.h:775
std::vector< Stop > mStops
Definition: Svg.h:456
virtual void drawPath(const svg::Path &path)
Definition: Svg.h:76
SVG tspan Element. Generally owned by a svg::Text Node. http://www.w3.org/TR/SVG/text.html#TSpanElement.
Definition: Svg.h:672
RadialGradient(const Node *parent, const XmlTree &xml)
Definition: Svg.cpp:1105
virtual void popLineJoin()
Definition: Svg.h:105
bool isDisplayNone() const
Definition: Svg.h:273
virtual Shape2d getShape() const
Returns a Shape2d representing the node in local coordinates. Not supported for Text.
Definition: Svg.h:637
bool specifiesOpacity() const
Definition: Svg.h:205
virtual bool containsPoint(const Vec2f &pt) const
Returns whether the point pt is inside of the Node's shape.
Definition: Svg.h:656
PolyLine2f mPolyLine
Definition: Svg.h:627
SVG Rect element: http://www.w3.org/TR/SVG/shapes.html#RectElement.
Definition: Svg.h:572
Vec2f mPoint2
Definition: Svg.h:568
virtual void pushLineJoin(LineJoin lineJoin)
Definition: Svg.h:104
virtual void popStroke()
Definition: Svg.h:93
bool specifiesStroke() const
Definition: Svg.h:199
virtual Rectf calcBoundingBox() const
Definition: Svg.h:605
SVG Radial gradient.
Definition: Svg.h:477
virtual Rectf calcBoundingBox() const
Definition: Svg.h:505
bool contains(const Vec2< Y > &pt) const
Is a point pt inside the rectangle.
Definition: Rect.h:80
void unspecifyFontWeight()
Definition: Svg.h:263
Gradient(const Node *parent, const XmlTree &xml)
Definition: Svg.cpp:996
void setVisitor(const std::function< bool(const Node &, svg::Style *)> &visitor)
Definition: Svg.cpp:172
Image(const Node *parent, const XmlTree &xml)
Definition: Svg.cpp:1887
const T * find(const std::string &id)
Recursively searches for a child element of type svg::T named id. Returns NULL on failure to find the...
Definition: Svg.h:739
virtual void drawLine(const svg::Line &line)
Definition: Svg.h:79
bool mSpecifiesLineCap
Definition: Svg.h:294
const Node & getChild(const std::string &id) const
Returns a reference to the child named id. Throws svg::ExcChildNotFound if not found.
Definition: Svg.cpp:1789
std::vector< Value > mX
Definition: Svg.h:682
void unspecifyTransform()
Removes the local transformation of this node, effectively making it the identity matrix...
Definition: Svg.h:351
bool specifiesLineCap() const
Definition: Svg.h:235
FillRule mFillRule
Definition: Svg.h:293
void startRender(Renderer &renderer, const Style &style) const
Definition: Svg.cpp:932
static FontWeight getFontWeightDefault()
Definition: Svg.h:266
void setFontFamily(const std::string &family)
Definition: Svg.h:252
Vec2f getTextPen() const
Definition: Svg.cpp:1961
std::vector< TextSpanRef > mSpans
Definition: Svg.h:709
PolyLine2f & getPolyLine()
Definition: Svg.h:597
MatrixAffine2f mTransform
Definition: Svg.h:460
Unit
Definition: Svg.h:128
SVG Paint specification for fill or stroke, including solids and gradients.
Definition: Svg.h:147
Shape2d mPath
Definition: Svg.h:550
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1161
float getStrokeWidth() const
Definition: Svg.h:225
MatrixAffine2f mTransform
Definition: Svg.h:420
const Node * findNodeByIdContains(const std::string &idPartial, bool recurse=true) const
Recursively searches for a child element whose name contains idPartial. Returns NULL on failure...
Definition: Svg.cpp:1690
float asUser(float percentOf=100, float dpi=72, float fontSize=12, float fontXHeight=7) const
Definition: Svg.cpp:524
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1980
Rectf calcPreciseBoundingBox() const
Returns the precise bounding box of the Shape's curves. Slower to calculate than calcBoundingBox().
Definition: Shape2d.cpp:115
float mRadius
Definition: Svg.h:176
bool isVisible() const
Definition: Svg.h:269
virtual void popFill()
Definition: Svg.h:91
virtual void pushStrokeOpacity(float opacity)
Definition: Svg.h:96
MatrixAffine2< T > invertCopy(T epsilon=EPSILON) const
Returns a copy of the matrix inverted. epsilon specifies the tolerance for testing for singularity...
Definition: MatrixAffine2.h:577
LinearGradient(const Node *parent, const XmlTree &xml)
Definition: Svg.cpp:1082
virtual bool containsPoint(const Vec2f &pt) const
Returns whether the point pt is inside of the Node's shape.
Definition: Svg.h:579
float mRadius
Definition: Svg.h:508
void startRender(Renderer &renderer, bool isNodeDrawable) const
Definition: Svg.cpp:473
Use(const Node *parent, const XmlTree &xml)
Definition: Svg.cpp:1854
Value getFontSize() const
Returns node's font size, or the first among its ancestors when it has none.
Definition: Svg.cpp:708
static FillRule getFillRuleDefault()
Definition: Svg.h:233
const Paint & getFill() const
Definition: Svg.h:195
float mValue
Definition: Svg.h:143
FontWeight
Definition: Svg.h:47
Rect(const Node *parent)
Definition: Svg.h:574
Vec2f getTextPen() const
Definition: Svg.cpp:2111
static DocRef create(const fs::path &filePath)
Definition: Svg.cpp:2169
SVG Line element: http://www.w3.org/TR/SVG/shapes.html#LineElement.
Definition: Svg.h:554
virtual Shape2d getShape() const
Returns a Shape2d representing the node in local coordinates. Not supported for Text.
Definition: Svg.h:544
Paint mFill
Definition: Svg.h:289
~Group()
Definition: Svg.cpp:1650
bool specifiesTransform() const
Returns whether this Node specifies a transformation.
Definition: Svg.h:345
void setFillRule(FillRule fillRule)
Definition: Svg.h:232
Style()
Definition: Svg.cpp:271
void setStrokeOpacity(float strokeOpacity)
Definition: Svg.h:214
bool visit(const Node &node, svg::Style *style) const
Definition: Svg.h:111
Vec2f mCenter
Definition: Svg.h:529
bool specifiesTransform() const
Definition: Svg.h:169
float getRadiusY() const
Definition: Svg.h:519
float getDpi() const
Returns the document's dots-per-inch. Currently hardcoded to 72.
Definition: Svg.h:803
GLuint GLenum GLenum transform
Definition: GLee.h:10032
size_t getNumColors() const
Definition: Svg.h:162
static float getOpacityDefault()
Definition: Svg.h:209
void unspecifyLineJoin()
Definition: Svg.h:242
Vec2i getSize() const
Returns the size of the document in pixels.
Definition: Svg.h:796
bool contains(const Vec2f &pt) const
Returns whether the point pt is contained within the boundaries of the shape.
Definition: Shape2d.cpp:135
static MatrixAffine2f parseTransform(const std::string &value)
Definition: Svg.cpp:788
const std::shared_ptr< Font > getFont() const
Definition: Svg.cpp:2092
const Paint & getStroke() const
Returns node's stroke, or the first among its ancestors when it has none.
Definition: Svg.cpp:645
Shape2d getShapeAbsolute() const
Returns a Shape2d representing the node in absolute coordinates. Not supported for Text...
Definition: Svg.h:367
virtual void pushStyle(const svg::Style &style)
Definition: Svg.h:88
static DocRef createFromSvgz(DataSourceRef dataSource, const fs::path &filePath=fs::path())
Definition: Svg.cpp:2179
virtual void pushLineCap(LineCap lineCap)
Definition: Svg.h:102
virtual const Node * findInAncestors(const std::string &elementId) const
Finds the node with ID elementId amongst this Node's ancestors. Returns NULL on failure.
Definition: Svg.cpp:948
void render(Renderer &renderer) const
Renders the node and its descendants.
Definition: Svg.cpp:916
float getFillOpacity() const
Returns node's fill opacity, or the first among its ancestors when it has none.
Definition: Svg.cpp:666
bool mVisible
Definition: Svg.h:306
float getRadiusX() const
Definition: Svg.h:518
const ColorA8u & getColor(size_t idx=0) const
Definition: Svg.h:160
class Doc * getDoc() const
Returns the svg::Doc this Node is an element of.
Definition: Svg.cpp:614
bool specifiesFill() const
Definition: Svg.h:193
const PolyLine2f & getPolyLine() const
Definition: Svg.h:596
MatrixAffine2f mTransform
Definition: Svg.h:178
Paint asPaint() const
Definition: Svg.cpp:1061
SVG Use Element, which instantiates a different element: http://www.w3.org/TR/SVG/struct.html#UseElement.
Definition: Svg.h:631
virtual void pushStroke(const class Paint &paint)
Definition: Svg.h:92
bool mSpecifiesOpacity
Definition: Svg.h:443
void setLineCap(LineCap lineCap)
Definition: Svg.h:238
virtual void pushFillRule(FillRule rule)
Definition: Svg.h:100
std::vector< std::string > mFontFamilies
Definition: Svg.h:301
Attributes()
Definition: Svg.h:676
std::shared_ptr< std::vector< std::pair< uint16_t, Vec2f > > > mGlyphMeasures
Definition: Svg.h:706
FillRule getFillRule() const
Returns node's fill rule, or the first among its ancestors when it has none.
Definition: Svg.cpp:680
Base class for SVG Gradients. See SVG Gradients: http://www.w3.org/TR/SVG/pservers.html#Gradients.
Definition: Svg.h:432
bool useObjectBoundingBox() const
Definition: Svg.h:168
Rectf getBoundingBoxAbsolute() const
Returns the absolute bounding box of the Node. Calculated and cached the first time it is requested...
Definition: Svg.h:362
virtual Rectf calcBoundingBox() const
Definition: Svg.h:548
const std::string & getString() const
Definition: Svg.h:692
Style mStyle
Definition: Svg.h:418
bool useObjectBoundingBox() const
Definition: Svg.h:446
bool contains(const Vec2f &pt) const
Returns whether the point pt is contained within the boundaries of the PolyLine.
Definition: PolyLine.cpp:92
const Shape2d & getShape2d() const
Definition: Svg.h:539
Value mFontSize
Definition: Svg.h:302
const Rectf & getRect() const
Definition: Svg.h:577
void setFontSize(const Value &fontSize)
Definition: Svg.h:259
LineJoin getLineJoin() const
Definition: Svg.h:243
float mOpacity
Definition: Svg.h:284
Path(const Node *parent)
Definition: Svg.h:536
void setTransform(const MatrixAffine2f &transform)
Sets the local transformation of this node.
Definition: Svg.h:349
Vec2f mCenter
Definition: Svg.h:507
std::shared_ptr< std::function< bool(const Node &, svg::Style *)> > mVisitor
Definition: Svg.h:120
virtual void pushFill(const class Paint &paint)
Definition: Svg.h:90
virtual bool containsPoint(const Vec2f &pt) const
Returns whether the point pt is inside of the Node's shape.
Definition: Svg.h:499
TextSpan(const Node *parent, const XmlTree &xml)
Definition: Svg.cpp:1993
std::string mString
Definition: Svg.h:704
virtual bool isDrawable() const
Definition: Svg.h:635
Vec2f mCoords0
Definition: Svg.h:175
Base class for an element of an SVG Document.
Definition: Svg.h:313
bool mSpecifiesFill
Definition: Svg.h:288
bool specifiesVisible() const
Definition: Svg.h:268
virtual void popStyle(const svg::Style &style)
Definition: Svg.h:89
virtual void drawImage(const svg::Image &image)
Definition: Svg.h:83
const Vec2f & getPoint1() const
Definition: Svg.h:559
void setVisible(bool visible)
Definition: Svg.h:270
virtual bool containsPoint(const Vec2f &pt) const
Returns whether the point pt is inside of the Node's shape.
Definition: Svg.h:599
MatrixAffine2f getTransformInverse() const
Returns the inverse of the local transformation of this node. Returns identity if the Node's transfor...
Definition: Svg.h:353
void setLineJoin(LineJoin lineJoin)
Definition: Svg.h:244
void unspecifyFontSize()
Definition: Svg.h:257
bool mSpecifiesColor
Definition: Svg.h:443
void fill(float value, float *array, size_t length)
fills array with value value
Definition: Dsp.cpp:169
TextSpan::Attributes mAttributes
Definition: Svg.h:725
virtual bool isDrawable() const
Definition: Svg.h:771
SVG Polygon Element: http://www.w3.org/TR/SVG/shapes.html#PolygonElement.
Definition: Svg.h:591
Rectf mRect
Definition: Svg.h:664
boost::geometry::model::polygon< boost::geometry::model::d2::point_xy< double > > polygon
Definition: ConvexHull.cpp:32
bool specifiesFontWeight() const
Definition: Svg.h:262
T y
Definition: Vector.h:71
void parse(const XmlTree &xml)
Definition: Svg.cpp:1088
Node * nodeUnderPoint(const Vec2f &absolutePoint, const MatrixAffine2f &parentInverseMatrix) const
Definition: Svg.cpp:1748
GLsizei const GLfloat * value
Definition: GLee.h:2487
SVG Image Element. Represents an unpremultiplied bitmap. http://www.w3.org/TR/SVG/struct.html#ImageElement.
Definition: Svg.h:649
Vec2f getCenter() const
Definition: Svg.h:496
float mFillOpacity
Definition: Svg.h:286
SVG Exception base-class.
Definition: Svg.h:824
void startRender(Renderer &renderer) const
Definition: Svg.cpp:2135
static Paint parsePaint(const char *value, bool *specified, const Node *parentNode)
Definition: Svg.cpp:722
bool isVisible() const
Returns whether this Node is visible, or the first among its ancestors when unspecified.
Definition: Svg.cpp:715
Unit mUnit
Definition: Svg.h:142
virtual Rectf calcBoundingBox() const
Definition: Svg.h:527
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:963
bool specifiesStrokeOpacity() const
Definition: Svg.h:211
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1873
void unspecifyFillOpacity()
Definition: Svg.h:218
bool mSpecifiesFillRule
Definition: Svg.h:292
ColorA8u mColor
Definition: Svg.h:441
const GLubyte * c
Definition: GLee.h:8491
Rectf mBoundingBox
Definition: Svg.h:422
Renderer()
Definition: Svg.h:68
fs::path mFilePath
Definition: Svg.h:665
float getAspectRatio() const
Returns the aspect ratio of the Doc (width / height)
Definition: Svg.h:798
virtual Rectf calcBoundingBox() const
Definition: Svg.h:566
FillRule
Definition: Svg.h:44
void finishRender(Renderer &renderer, bool isNodeDrawable) const
Definition: Svg.cpp:502
float mDy
Definition: Svg.h:683
virtual void drawCircle(const svg::Circle &circle)
Definition: Svg.h:81
LineJoin mLineJoin
Definition: Svg.h:297
Value getFontSize() const
Definition: Svg.h:258
virtual void popTextRotation()
Definition: Svg.h:109
void finishRender(Renderer &renderer) const
Definition: Svg.cpp:2145
bool mSpecifiesFontFamilies
Definition: Svg.h:300
const std::vector< T > & getPoints() const
Definition: PolyLine.h:36
void setStroke(const Paint &stroke)
Definition: Svg.h:202
void unspecifyStroke()
Definition: Svg.h:200
bool isUser() const
Definition: Svg.h:135
virtual void drawPolygon(const svg::Polygon &polygon)
Definition: Svg.h:78
const std::shared_ptr< Surface8u > getSurface() const
Definition: Svg.h:654
bool specifiesStrokeWidth() const
Definition: Svg.h:223
bool isNone() const
Definition: Svg.h:157
int32_t getWidth() const
Returns the width of the document in pixels.
Definition: Svg.h:792
uint8_t mType
Definition: Svg.h:172
void unspecifyFillRule()
Definition: Svg.h:230
RectT< float > Rectf
Definition: Rect.h:139
std::shared_ptr< Shape2d > mShape
Definition: Svg.h:707
float mOffset
Definition: Svg.h:440
virtual Rectf calcBoundingBox() const
Definition: Svg.h:625
float mRadiusX
Definition: Svg.h:530
const PolyLine2f & getPolyLine() const
Definition: Svg.h:616
static const std::vector< std::string > & getFontFamiliesDefault()
Definition: Svg.cpp:326
const Paint & getFill() const
Returns node's fill, or the first among its ancestors when it has none.
Definition: Svg.cpp:638
const std::string & getId() const
Returns the ID of this Node when present.
Definition: Svg.h:323
Vec2f mCoords0
Definition: Svg.h:457
void setOpacity(float opacity)
Definition: Svg.h:208
virtual void popLineCap()
Definition: Svg.h:103
Value()
Definition: Svg.h:130
const std::list< Node * > & getChildren() const
Returns a reference to the list of the Group's children.
Definition: Svg.h:760
bool mSpecifiesLineJoin
Definition: Svg.h:296
static float getStrokeOpacityDefault()
Definition: Svg.h:215
float mTextLength
Definition: Svg.h:685
virtual void popTextPen()
Definition: Svg.h:107
bool specifiesLineJoin() const
Definition: Svg.h:241
virtual Shape2d getShape() const
Returns a Shape2d representing the node in local coordinates. Not supported for Text.
Definition: Svg.cpp:1551
static const Paint & getFillDefault()
Definition: Svg.h:197
bool isRadialGradient() const
Definition: Svg.h:159
Vec2f mCoords1
Definition: Svg.h:457
void parseStyleAttribute(const std::string &stylePropertyString, const Node *parent)
Definition: Svg.cpp:337
virtual Rectf calcBoundingBox() const
Definition: Svg.h:585
SVG Path element: http://www.w3.org/TR/SVG/paths.html#PathElement.
Definition: Svg.h:534
Vec2f mCoords1
Definition: Svg.h:175
float getRadius() const
Definition: Svg.h:497
Represents an SVG Document. See SVG Document Structure http://www.w3.org/TR/SVG/struct.html.
Definition: Svg.h:781
const Node * mReferenced
Definition: Svg.h:645
void parse(const XmlTree &xml)
Definition: Svg.cpp:1860
bool specifiesFontSize() const
Definition: Svg.h:256
Definition: Exception.h:32
Stop(const Node *parent, const XmlTree &xml)
Definition: Svg.cpp:1039
std::list< Node * > & getChildren()
Returns a reference to the list of the Group's children.
Definition: Svg.h:762
Paint()
Definition: Svg.cpp:184
static MatrixAffine2< float > identity()
Definition: MatrixAffine2.h:182
static Value parse(const char **sInOut)
Definition: Svg.cpp:550
virtual void popFillRule()
Definition: Svg.h:101
virtual Rectf calcBoundingBox() const
Definition: Svg.h:406
std::string getDomPath() const
Returns a DOM-style path to this node.
Definition: Svg.cpp:626
void parseStyle(const std::string &value)
Base class from which Renderers are derived.
Definition: Svg.h:66
virtual bool isDrawable() const
Definition: Svg.h:400
bool specifiesTransform() const
Definition: Svg.h:447
virtual void drawTextSpan(const svg::TextSpan &span)
Definition: Svg.h:84
const std::vector< std::string > & getFontFamilies() const
Definition: Svg.h:250
GLenum GLenum GLvoid GLvoid GLvoid * span
Definition: GLee.h:1089
Attributes mAttributes
Definition: Svg.h:703
float mLengthAdjust
Definition: Svg.h:686
LineCap mLineCap
Definition: Svg.h:295
const GLfloat * m
Definition: GLee.h:13493
void copyAttributesFrom(const Gradient &rhs)
Definition: Svg.cpp:1027
std::function< bool(const Node &, svg::Style *)> RenderVisitor
Definition: Svg.h:61
bool mSpecifiesFontSize
Definition: Svg.h:300
void unspecifyLineCap()
Definition: Svg.h:236
void unspecifyOpacity()
Definition: Svg.h:206
void finishRender(Renderer &renderer, const Style &style) const
Definition: Svg.cpp:940
static std::shared_ptr< Surface8u > parseDataImage(const std::string &data)
Definition: Svg.cpp:1909
MatrixAffine2f getTransformAbsoluteInverse() const
Returns the inverse of the absolute transformation of this node, which includes inherited transformat...
Definition: Svg.h:357
static std::string findStyleValue(const std::string &styleString, const std::string &key)
Definition: Svg.cpp:886
Polygon(const Node *parent)
Definition: Svg.h:593
virtual void pushStrokeWidth(float width)
Definition: Svg.h:98
static LineCap getLineCapDefault()
Definition: Svg.h:239
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1593
std::shared_ptr< class DataSource > DataSourceRef
Definition: DataSource.h:35
const Node * getParent() const
Returns the immediate parent of this node.
Definition: Svg.h:321
GLdouble s
Definition: GLee.h:1378
bool specifiesFillRule() const
Definition: Svg.h:229
const Style & getStyle() const
Returns the style elements defined on this Node but not inherited from ancestors. ...
Definition: Svg.h:327
Paint asPaint() const
Definition: Svg.cpp:1096
bool mSpecifiesStroke
Definition: Svg.h:288
LineCap getLineCap() const
Definition: Svg.h:237
Text(const Node *parent, const XmlTree &xml)
Definition: Svg.cpp:1937
std::list< Node * > mChildren
Definition: Svg.h:774
SVG Linear gradient.
Definition: Svg.h:464
virtual const char * what() const
Definition: Svg.h:843
const Vec2f & getPoint2() const
Definition: Svg.h:560
void unspecifyFontFamilies()
Definition: Svg.h:249
float getOpacity() const
Returns node's opacity, or the first among its ancestors when it has none.
Definition: Svg.cpp:659
bool isPercent() const
Definition: Svg.h:136
MatrixAffine2f getTransform() const
Returns the local transformation of this node. Returns identity if the Node's transform isn't specifi...
Definition: Svg.h:347
float mRadiusY
Definition: Svg.h:530
Rectf getBoundingBox() const
Returns the local bounding box of the Node. Calculated and cached the first time it is requested...
Definition: Svg.h:360
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1138
std::string mId
Definition: Svg.h:417
virtual void popStrokeWidth()
Definition: Svg.h:99
const std::vector< std::string > & getFontFamilies() const
Returns node's font families, or the first among its ancestors when it has none.
Definition: Svg.cpp:701
virtual Rectf calcBoundingBox() const
Definition: Svg.cpp:1832
virtual Shape2d getShape() const
Returns a Shape2d representing the node in local coordinates. Not supported for Text.
Definition: Svg.cpp:1598
void setFill(const Paint &fill)
Definition: Svg.h:196
T distanceSquared(const Vec2< T > &rhs) const
Definition: Vector.h:170
Value(float value, Unit unit=USER)
Definition: Svg.h:131
bool parseProperty(const std::string &key, const std::string &value, const Node *parent)
Definition: Svg.cpp:349
bool isPixels() const
Definition: Svg.h:137
float getRadius() const
Definition: Svg.h:167
const T * findByIdContains(const std::string &idPartial)
Recursively searches for a child element of type svg::T whose name contains idPartial. Returns NULL on failure to find the object or if it is not of type T.
Definition: Svg.h:744
int32_t getHeight() const
Returns the height of the document in pixels.
Definition: Svg.h:794
PolyLine2f mPolyLine
Definition: Svg.h:607
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:2018
LineCap
Definition: Svg.h:45
virtual void drawRect(const svg::Rect &rect)
Definition: Svg.h:80
virtual void popMatrix()
Definition: Svg.h:87
Vec2< int > Vec2i
Definition: Vector.h:1313
Rectf mRect
Definition: Svg.h:587
virtual void renderSelf(Renderer &renderer) const
Definition: Svg.cpp:1509
float getStrokeOpacity() const
Definition: Svg.h:213
std::shared_ptr< Surface8u > mImage
Definition: Svg.h:666
ExcChildNotFound(const std::string &child)
Definition: Svg.cpp:2277
virtual Shape2d getShape() const
Returns a Shape2d representing the node in local coordinates. Not supported for Text.
Definition: Svg.cpp:1628
Area getBounds() const
Returns the bounds of the Doc (0,0,width,height)
Definition: Svg.h:800
const Paint & getStroke() const
Definition: Svg.h:201
GLuint color
Definition: GLee.h:3198