diff src/redraw_man.c @ 356:3e84458968ec

Move mb_img_data_t out from argument list of rdman_shape_image_new(). - Application should specify content of sh_image_t by fill the shape with a paint_image_t.
author Thinker K.F. Li <thinker@branda.to>
date Mon, 09 Mar 2009 23:05:57 +0800
parents 85b8bb36fe71
children 44b8223f307c
line wrap: on
line diff
--- a/src/redraw_man.c	Mon Mar 09 01:35:19 2009 +0800
+++ b/src/redraw_man.c	Mon Mar 09 23:05:57 2009 +0800
@@ -2271,6 +2271,24 @@
 
 /* @} */
 
+/*! \brief Load an image as a paint_image_t.
+ */
+paint_t *rdman_img_ldr_load_paint(redraw_man_t *rdman, const char *img_id) {
+    mb_img_data_t *img_data;
+    paint_t *paint;
+    mb_img_ldr_t *ldr = rdman_img_ldr(rdman);
+    
+    img_data = MB_IMG_LDR_LOAD(ldr, img_id);
+    if(img_data == NULL)
+	return NULL;
+    
+    paint = rdman_paint_image_new(rdman, img_data);
+    if(paint == NULL)
+	MB_IMG_DATA_FREE(img_data);
+    
+    return paint;
+}
+
 #ifdef UNITTEST
 /* Test cases */