diff src/shape_image.c @ 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 a8d20bc8ce40
children 7bd6c0e88ec8
line wrap: on
line diff
--- a/src/shape_image.c	Fri Mar 04 21:09:49 2011 +0800
+++ b/src/shape_image.c	Sat Mar 05 22:00:16 2011 +0800
@@ -92,6 +92,22 @@
     return (shape_t *)img;
 }
 
+shape_t *
+rdman_shape_image_clone(redraw_man_t *rdman, const shape_t *_src_img) {
+    const sh_image_t *src_img = (const sh_image_t *)_src_img;
+    sh_image_t *new_img;
+
+    new_img = (sh_image_t *)rdman_shape_image_new(rdman,
+						  src_img->x, src_img->y,
+						  src_img->w, src_img->h);
+    if(new_img == NULL)
+	return NULL;
+    
+    sh_copy_style(rdman, (shape_t *)src_img, (shape_t *)new_img);
+
+    return (shape_t *)new_img;
+}
+
 void sh_image_free(shape_t *shape) {
     sh_image_t *img = (sh_image_t *)shape;