7 #include "../contrib/pugixml-1.4/src/pugixml.hpp"
10 typedef struct stbtt_fontinfo stbtt_fontinfo;
17 Document(const std::string & filename = "") : m_objects(), m_count(0) {Load(filename);}
18 virtual ~Document() {}
22 void Load(const std::string & filename = "");
23 void Save(const std::string & filename);
24 void DebugDumpObjects();
26 unsigned ObjectCount() const {return m_count;}
27 inline const Objects & GetObjects() const {return m_objects;}
29 bool operator==(const Document & equ) const;
30 bool operator!=(const Document & equ) const {return !(this->operator==(equ));}
32 void Add(ObjectType type, const Rect & bounds, unsigned data_index = 0);
33 unsigned AddBezierData(const Bezier & bezier);
38 /** SVG Related functions **/
40 /** Load an SVG text file and add to the document **/
41 void LoadSVG(const std::string & filename, const Rect & bounds = Rect(0,0,1,1));
43 /** Parse an SVG node or SVG-group node, adding children to the document **/
44 void ParseSVGNode(pugi::xml_node & root, const Rect & bounds, Real & width, Real & height);
45 /** Parse an SVG path with string **/
46 void ParseSVGPathData(const std::string & d, const Rect & bounds);
48 void AddFontGlyphAtPoint(stbtt_fontinfo *font, int character, Real scale, Real x, Real y);
50 #ifndef QUADTREE_DISABLED
51 inline const QuadTree& GetQuadTree() { if (m_quadtree.root_id == QUADTREE_EMPTY) { GenBaseQuadtree(); } return m_quadtree; }
52 QuadTreeIndex GenQuadChild(QuadTreeIndex parent, QuadTreeNodeChildren type);
53 QuadTreeIndex GenQuadParent(QuadTreeIndex child, QuadTreeNodeChildren mytype);
59 #ifndef QUADTREE_DISABLED
61 void GenBaseQuadtree();