+unsigned Document::AddPath(unsigned start_index, unsigned end_index, const Colour & fill, const Colour & stroke)
+{
+ Path path(m_objects, start_index, end_index, fill, stroke);
+ unsigned data_index = AddPathData(path);
+ Rect bounds = path.SolveBounds(m_objects);
+ unsigned result = Add(PATH, bounds,data_index);
+ //Debug("Added path %u -> %u (%u objects) colour {%u,%u,%u,%u}, stroke {%u,%u,%u,%u}", start_index, end_index, (end_index - start_index), fill.r, fill.g, fill.b, fill.a, stroke.r, stroke.g, stroke.b, stroke.a);
+ return result;
+}
+
+/**
+ * Add a Bezier using Absolute coords
+ */
+unsigned Document::AddBezier(const Bezier & bezier)
+{
+ Rect bounds = bezier.SolveBounds();
+ Bezier data = bezier.ToRelative(bounds); // Relative
+ if (data.ToAbsolute(bounds) != bezier)
+ {
+ Warn("%s != %s", data.ToAbsolute(Rect(0,0,1,1)).Str().c_str(),
+ bezier.Str().c_str());
+ Warn("ToAbsolute on ToRelative does not give original Bezier");
+ }
+ unsigned index = AddBezierData(data);
+ return Add(BEZIER, bounds, index);
+}
+
+unsigned Document::Add(ObjectType type, const Rect & bounds, unsigned data_index)