diff include/mb_types.h @ 1370:bae104d8d247

Add clone functions for shape types
author Thinker K.F. Li <thinker@codemud.net>
date Sat, 05 Mar 2011 22:00:16 +0800
parents 18d718a76a45
children e22df2f3bffe
line wrap: on
line diff
--- a/include/mb_types.h	Fri Mar 04 21:09:49 2011 +0800
+++ b/include/mb_types.h	Sat Mar 05 22:00:16 2011 +0800
@@ -392,5 +392,14 @@
 #define sh_get_stroke(sh) ((sh)->stroke)
 #define sh_set_stroke_width(sh, v) do { (sh)->stroke_width = (v); } while(0)
 #define sh_get_stroke_width(sh) (sh)->stroke_width
+#define sh_copy_style(rdman, sh_src, sh_dst) do {			\
+	if(sh_get_fill(sh_src))						\
+	    rdman_paint_fill((rdman), sh_get_fill(sh_src), (sh_dst));	\
+	if(sh_get_stroke(sh_src))					\
+	    rdman_paint_stroke((rdman), sh_get_stroke(sh_src), (sh_dst)); \
+	(sh_dst)->stroke_width = (sh_src)->stroke_width;		\
+	(sh_dst)->stroke_linecap = (sh_src)->stroke_linecap;		\
+	(sh_dst)->stroke_linejoin = (sh_src)->stroke_linejoin;		\
+    } while(0)
 
 #endif /* __MB_TYPES_H_ */