Modify marker transform to accept user defined marker symbols - 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 Abbate <francesco.bbt@gmail.com>2011年12月18日 17:01:37 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2011年12月18日 17:01:37 +0100
commit5f093983d4e62111c97436bbb2ce7bf433d1fe7b (patch)
tree97f2f5d7579c0e0d0de0e28fe87bc814593ee892 /agg-plot/agg-parse-trans.cpp
parentee563973094a8235631d5208bd672f8cbbe15fdc (diff)
downloadgsl-shell-5f093983d4e62111c97436bbb2ce7bf433d1fe7b.tar.gz
Modify marker transform to accept user defined marker symbols
Diffstat (limited to 'agg-plot/agg-parse-trans.cpp')
-rw-r--r--agg-plot/agg-parse-trans.cpp 23
1 files changed, 18 insertions, 5 deletions
diff --git a/agg-plot/agg-parse-trans.cpp b/agg-plot/agg-parse-trans.cpp
index 4ae1cdbc..47ccdbe5 100644
--- a/agg-plot/agg-parse-trans.cpp
+++ b/agg-plot/agg-parse-trans.cpp
@@ -91,11 +91,24 @@ sg_object* build_curve (lua_State *L, int specindex, sg_object* src)
sg_object* build_marker (lua_State *L, int specindex, sg_object* src)
{
- double size = mlua_named_optnumber (L, specindex, "size", 3.0);
- const char *sym_name = mlua_named_optstring (L, specindex, "mark", "circle");
- sg_object* sym = new_marker_symbol(sym_name);
- trans::marker* m = new trans::marker(src, size, sym);
- return m;
+ double size = mlua_named_optnumber(L, specindex, "size", 3.0);
+
+ lua_getfield(L, specindex, "mark");
+ const char *sym_name = lua_tostring(L, -1);
+
+ sg_object *sym;
+ if (!sym_name && gs_is_userdata(L, -1, GS_DRAW_SCALABLE))
+ {
+ sg_object* obj = (sg_object*) lua_touserdata(L, -1);
+ sym = new trans::scaling_a(obj);
+ }
+ else
+ {
+ sym = new_marker_symbol(sym_name ? sym_name : "circle");
+ }
+ lua_pop(L, 1);
+
+ return new trans::marker(src, size, sym);
}
sg_object* build_dash (lua_State *L, int specindex, sg_object* src)
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月14日 10:53:34 +0000

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