gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/agg-parse-trans.cpp
diff options
context:
space:
mode:
authorfrancesco-ST <francesco.abbate@st.com>2010年12月28日 13:36:33 +0100
committerfrancesco-ST <francesco.abbate@st.com>2010年12月28日 13:36:33 +0100
commit45ae5dceb38d665e446960618cb8c1cda5f5afc5 (patch)
treee596adfbe330b99d6a0b6b7cd684510b5a10680e /agg-plot/agg-parse-trans.cpp
parent6d4c09d61a370c79ed8b41282ed7ad13a0d7f989 (diff)
downloadgsl-shell-45ae5dceb38d665e446960618cb8c1cda5f5afc5.tar.gz
added "scale" affine transformation for graphics pipeline
Added a specific error code. Documentation and fractal example updated.
Diffstat (limited to 'agg-plot/agg-parse-trans.cpp')
-rw-r--r--agg-plot/agg-parse-trans.cpp 21
1 files changed, 21 insertions, 0 deletions
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"
};
@@ -177,6 +178,25 @@ build_translate (lua_State *L, int specindex, typename context::base_type *obj)
}
template <class context> typename context::base_type*
+build_scale (lua_State *L, int specindex, typename context::base_type *obj)
+{
+ typedef typename trans<context>::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 <class context> typename context::base_type*
build_rotate (lua_State *L, int specindex, typename context::base_type *obj)
{
typedef typename trans<context>::affine affine_type;
@@ -227,6 +247,7 @@ const typename builder<context>::reg builder<context>::builder_table[] = {
{"marker", build_marker <context>},
{"extend", build_extend <context>},
{"translate", build_translate<context>},
+ {"scale", build_scale <context>},
{"rotate", build_rotate <context>},
{NULL, NULL}
};
generated by cgit v1.2.3 (git 2.25.1) at 2025年09月15日 10:52:28 +0000

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