8 Path::Path(const Objects & objects, unsigned start, unsigned end, const Colour & fill)
9 : m_start(start), m_end(end), m_fill(fill)
11 Real xmin = 0; Real ymin = 0;
12 Real xmax = 0; Real ymax = 0;
14 // Find the bounds coordinates
15 // and identify the top left and bottom right objects
22 for (unsigned i = m_start; i <= m_end; ++i)
24 const Rect & objb = objects.bounds[i];
26 if (i == m_start || objb.x < xmin)
31 if (i == m_start || (objb.x+objb.w) > xmax)
33 xmax = (objb.x+objb.w);
37 if (i == m_start || objb.y < ymin)
42 if (i == m_start || (objb.y+objb.h) > ymax)
44 ymax = (objb.y+objb.h);
49 // Get actual turning point coords of the 4 edge case beziers
50 m_top = objects.beziers[objects.data_indices[top]].ToAbsolute(objects.bounds[top]).GetTop();
51 m_bottom = objects.beziers[objects.data_indices[bottom]].ToAbsolute(objects.bounds[bottom]).GetBottom();
52 m_left = objects.beziers[objects.data_indices[left]].ToAbsolute(objects.bounds[left]).GetLeft();
53 m_right = objects.beziers[objects.data_indices[right]].ToAbsolute(objects.bounds[right]).GetRight();
54 /*Debug("Top: %f, %f", m_top.first, m_top.second);
55 Debug("Bottom: %f, %f", m_bottom.first, m_bottom.second);
56 Debug("Left: %f, %f", m_left.first, m_left.second);
57 Debug("Right: %f, %f", m_right.first, m_right.second);
58 Debug("Left - Right: %f, %f", m_right.first - m_left.first, m_right.second - m_left.second);
59 Debug("Top - Bottom: %f, %f", m_top.first - m_bottom.first, m_top.second - m_bottom.second);
63 Rect Path::SolveBounds(const Objects & objects) const
65 return Rect(m_left.first, m_top.second, m_right.first-m_left.first, m_bottom.second-m_top.second);