19 #ifndef AGG_BOUNDING_RECT_INCLUDED 20 #define AGG_BOUNDING_RECT_INCLUDED 22 #include "agg_basics.h" 28 template<
class VertexSource,
class GetId,
class CoordT>
29 bool bounding_rect(VertexSource& vs, GetId& gi,
30 unsigned start,
unsigned num,
31 CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2)
43 for(i = 0; i < num; i++)
45 vs.rewind(gi[start + i]);
47 while(!is_stop(cmd = vs.vertex(&x, &y)))
61 if(CoordT(x) < *x1) *x1 = CoordT(x);
62 if(CoordT(y) < *y1) *y1 = CoordT(y);
63 if(CoordT(x) > *x2) *x2 = CoordT(x);
64 if(CoordT(y) > *y2) *y2 = CoordT(y);
69 return *x1 <= *x2 && *y1 <= *y2;
74 template<
class VertexSource,
class CoordT>
75 bool bounding_rect_single(VertexSource& vs,
unsigned path_id,
76 CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2)
89 while(!is_stop(cmd = vs.vertex(&x, &y)))
103 if(CoordT(x) < *x1) *x1 = CoordT(x);
104 if(CoordT(y) < *y1) *y1 = CoordT(y);
105 if(CoordT(x) > *x2) *x2 = CoordT(x);
106 if(CoordT(y) > *y2) *y2 = CoordT(y);
110 return *x1 <= *x2 && *y1 <= *y2;