[Rawstudio-commit] r1248 - trunk/src

Anders Brander anders at brander.dk
Sat May 19 18:47:28 CEST 2007


Author: abrander
Date: 2007-05-19 18:47:27 +0200 (Sat, 19 May 2007)
New Revision: 1248

Modified:
   trunk/src/rs-image.c
   trunk/src/rs-image.h
Log:
Added rs_image8_render_exposure_mask().

Modified: trunk/src/rs-image.c
===================================================================
--- trunk/src/rs-image.c	2007-05-19 15:37:16 UTC (rev 1247)
+++ trunk/src/rs-image.c	2007-05-19 16:47:27 UTC (rev 1248)
@@ -597,6 +597,54 @@
 	return;
 }
 
+/**
+ * Renders an exposure map on top of an RS_IMAGE8 with 3 channels
+ * @param image A RS_IMAGE8
+ * @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)
+{
+	gint row, col;
+	gint start = 0;
+	gint stop = image->h;
+
+	g_assert(image != NULL);
+	g_assert(image->channels == 3);
+
+	if ((only_row > -1) && (only_row < image->h))
+	{
+		start = only_row;
+		stop = only_row + 1;
+	}
+
+	for(row=start;row<stop;row++)
+	{
+		/* Get start pixel of row */
+		guchar *pixel = GET_PIXEL(image, 0, row);
+
+		for(col=0;col<image->w;col++)
+		{
+			/* Catch pixels overexposed and color them red */
+			if ((pixel[R]==0xFF) || (pixel[G]==0xFF) || (pixel[B]==0xFF))
+			{
+				*pixel++ = 0xFF;
+				*pixel++ = 0x00;
+				*pixel++ = 0x00;
+			}
+			/* Color underexposed pixels blue */
+			else if ((pixel[R]<2) && (pixel[G]<2) && (pixel[B]<2))
+			{
+				*pixel++ = 0x00;
+				*pixel++ = 0x00;
+				*pixel++ = 0xFF;
+			}
+			else
+				pixel += 3;
+		}
+	}
+}
+
 RS_IMAGE16 *
 rs_image16_copy(RS_IMAGE16 *in)
 {

Modified: trunk/src/rs-image.h
===================================================================
--- trunk/src/rs-image.h	2007-05-19 15:37:16 UTC (rev 1247)
+++ trunk/src/rs-image.h	2007-05-19 16:47:27 UTC (rev 1248)
@@ -34,6 +34,13 @@
 extern void rs_image16_free(RS_IMAGE16 *rsi);
 extern RS_IMAGE8 *rs_image8_new(const guint width, const guint height, const guint channels, const guint pixelsize);
 extern void rs_image8_free(RS_IMAGE8 *rsi);
+
+/**
+ * Renders an exposure map on top of an RS_IMAGE8
+ * @param image A RS_IMAGE8
+ * @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 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);
 extern RS_IMAGE16 *rs_image16_transform(RS_IMAGE16 *in, RS_IMAGE16 *out, RS_MATRIX3 *affine, RS_MATRIX3 *inverse_affine,




More information about the Rawstudio-commit mailing list