[Rawstudio-commit] r1777 - trunk/src

Anders Brander anders at brander.dk
Tue Apr 15 23:02:41 CEST 2008


Author: abrander
Date: 2008-04-15 23:02:40 +0200 (Tue, 15 Apr 2008)
New Revision: 1777

Modified:
   trunk/src/rs-image.c
   trunk/src/rs-image.h
Log:
Replaced rs_image8_render_exposure_mask() with gdk_pixbuf_render_exposure_mask().

Modified: trunk/src/rs-image.c
===================================================================
--- trunk/src/rs-image.c	2008-04-15 20:56:31 UTC (rev 1776)
+++ trunk/src/rs-image.c	2008-04-15 21:02:40 UTC (rev 1777)
@@ -870,22 +870,27 @@
 }
 
 /**
- * Renders an exposure map on top of an RS_IMAGE8 with 3 channels
- * @param image A RS_IMAGE8
+ * Renders an exposure map on top of an GdkPixbuf with 3 channels
+ * @param pixbuf A GdkPixbuf
  * @param only_row A single row to render or -1 to render all
  */
 void
-rs_image8_render_exposure_mask(RS_IMAGE8 *image, gint only_row)
+gdk_pixbuf_render_exposure_mask(GdkPixbuf *pixbuf, gint only_row)
 {
 	gint row, col;
 	gint start;
 	gint stop;
+	gint height;
+	gint width;
 
-	g_assert(image != NULL);
-	g_assert(image->channels == 3);
+	g_assert(GDK_IS_PIXBUF(pixbuf));
+	g_assert(gdk_pixbuf_get_n_channels(pixbuf) == 3);
 
-	rs_image8_ref(image);
-	if ((only_row > -1) && (only_row < image->h))
+	g_object_ref(pixbuf);
+	width = gdk_pixbuf_get_width(pixbuf);
+	height = gdk_pixbuf_get_height(pixbuf);
+
+	if ((only_row > -1) && (only_row < height))
 	{
 		start = only_row;
 		stop = only_row + 1;
@@ -893,15 +898,15 @@
 	else
 	{
 		start = 0;
-		stop = image->h;
+		stop = height;
 	}
 
 	for(row=start;row<stop;row++)
 	{
 		/* Get start pixel of row */
-		guchar *pixel = GET_PIXEL(image, 0, row);
+		guchar *pixel = GET_PIXBUF_PIXEL(pixbuf, 0, row);
 
-		for(col=0;col<image->w;col++)
+		for(col=0;col<width;col++)
 		{
 			/* Catch pixels overexposed and color them red */
 			if ((pixel[R]==0xFF) || (pixel[G]==0xFF) || (pixel[B]==0xFF))
@@ -921,7 +926,7 @@
 				pixel += 3;
 		}
 	}
-	rs_image8_unref(image);
+	g_object_unref(pixbuf);
 }
 
 /**

Modified: trunk/src/rs-image.h
===================================================================
--- trunk/src/rs-image.h	2008-04-15 20:56:31 UTC (rev 1776)
+++ trunk/src/rs-image.h	2008-04-15 21:02:40 UTC (rev 1777)
@@ -73,11 +73,12 @@
 RS_IMAGE8 *rs_image8_render_shaded(RS_IMAGE8 *in, RS_IMAGE8 *out);
 
 /**
- * Renders an exposure map on top of an RS_IMAGE8
- * @param image A RS_IMAGE8
+ * Renders an exposure map on top of an GdkPixbuf with 3 channels
+ * @param pixbuf A GdkPixbuf
  * @param only_row A single row to render or -1 to render all
  */
-extern void rs_image8_render_exposure_mask(RS_IMAGE8 *image, gint only_row);
+extern void gdk_pixbuf_render_exposure_mask(GdkPixbuf *pixbuf, gint only_row);
+
 extern void rs_image16_orientation(RS_IMAGE16 *rsi, gint orientation);
 extern void rs_image16_transform_getwh(RS_IMAGE16 *in, RS_RECT *crop, gdouble angle, gint orientation, gint *w, gint *h);
 




More information about the Rawstudio-commit mailing list