From 45ae5dceb38d665e446960618cb8c1cda5f5afc5 Mon Sep 17 00:00:00 2001 From: francesco-ST Date: 2010年12月28日 13:36:33 +0100 Subject: added "scale" affine transformation for graphics pipeline Added a specific error code. Documentation and fractal example updated. --- agg-plot/agg-parse-trans.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'agg-plot/agg-parse-trans.cpp') diff --git a/agg-plot/agg-parse-trans.cpp b/agg-plot/agg-parse-trans.cpp index 42f528fa..4547db24 100644 --- a/agg-plot/agg-parse-trans.cpp +++ b/agg-plot/agg-parse-trans.cpp @@ -46,6 +46,7 @@ struct property_reg line_join_properties[] = { const char *agg_spec_error::m_msg[] = { "invalid specification tag", "invalid specification table", + "missing specification parameter", "invalid graphical object", "generic error during graphical operation" }; @@ -176,6 +177,25 @@ build_translate (lua_State *L, int specindex, typename context::base_type *obj) return (typename context::base_type *) t; } +template typename context::base_type* +build_scale (lua_State *L, int specindex, typename context::base_type *obj) +{ + typedef typename trans::affine affine_type; + + lua_rawgeti (L, specindex, 2); + + if (! lua_isnumber (L, -1)) + throw agg_spec_error(agg_spec_error::missing_parameter); + + double s = lua_tonumber (L, -1); + lua_pop (L, 1); + + agg::trans_affine mtx(s, 0.0, 0.0, s, 0.0, 0.0); + affine_type *t = new affine_type(obj, mtx); + + return (typename context::base_type *) t; +} + template typename context::base_type* build_rotate (lua_State *L, int specindex, typename context::base_type *obj) { @@ -227,6 +247,7 @@ const typename builder::reg builder::builder_table[] = { {"marker", build_marker }, {"extend", build_extend }, {"translate", build_translate}, + {"scale", build_scale }, {"rotate", build_rotate }, {NULL, NULL} }; -- cgit v1.2.3

AltStyle によって変換されたページ (->オリジナル) /