-rw-r--r-- | agg-plot/utils.cpp | 7 |
diff --git a/agg-plot/utils.cpp b/agg-plot/utils.cpp index 7f6f8697..eb0e908a 100644 --- a/agg-plot/utils.cpp +++ b/agg-plot/utils.cpp @@ -14,3 +14,10 @@ trans_affine_compose (agg::trans_affine& a, const agg::trans_affine& b) a.tx = b.sx * a_tx + b.shx * a_ty + b.tx; a.ty = b.shy * a_tx + b.sy * a_ty + b.ty; } + +agg::trans_affine affine_matrix(const agg::rect_i& r) +{ + double w = r.x2 - r.x1, h = r.y2 - r.y1; + double tx = r.x1, ty = r.y1; + return agg::trans_affine(w, 0.0, 0.0, h, tx, ty); +} |