? autom4te.cache
? compile
? depcomp
? stamp-h1
? cursors/Makefile
? cursors/Makefile.in
? cursors/1_32/Makefile
? cursors/1_32/Makefile.in
? docs/Makefile
? docs/Makefile.in
? docs/reference/Makefile
? docs/reference/Makefile.in
? docs/reference/doxygen-output.txt
? docs/reference/doxygen-warnings.log
? docs/reference/doxygen-warnings.txt
? docs/reference/html
? magnifier/GNOME_Magnifier-imodule.c
? po/Makefile.in.in
? po/stamp-it
? test/control-client
? test/mag-test
Index: idl/GNOME_Magnifier.idl
===================================================================
RCS file: /cvs/gnome/gnome-mag/idl/GNOME_Magnifier.idl,v
retrieving revision 1.11
diff -u -p -r1.11 GNOME_Magnifier.idl
--- idl/GNOME_Magnifier.idl	24 Jul 2006 23:12:38 -0000	1.11
+++ idl/GNOME_Magnifier.idl	25 Nov 2006 20:09:22 -0000
@@ -140,6 +140,30 @@ module GNOME {
      **/
     void getContrast (out float R, out float G, out float B);
 
+     /**
+     * Set the zoom region image brightness.
+     * Set the brightness applied to each image component (reg, green and
+     * blue). The input for each component must be in the range between -1 and
+     * 1, if the are bigger or lower then this range, the value will be clamped
+     * to the interval. The value -1 means reduce 100% the brightness,
+     * resulting in a black image. The value 1 means increase 100% the
+     * brightness, resulting in a white image.
+     * @param R the brightness applied to the red component.
+     * @param G the brightness applied to the green component.
+     * @param B the brightness applied to the blue component.
+     **/
+    void setBrightness (in float R, in float G, in float B);
+
+    /**
+     * Get the zoom region image brightness.
+     * Get the brightness applied to each image component (red, green and
+     * blue).
+     * @param R the brightness applied to the red component.
+     * @param G the brightness applied to the green component.
+     * @param B the brightness applied to the blue component.
+     **/
+    void getBrightness (out float R, out float G, out float B);
+
     };
 
     typedef sequence<ZoomRegion> ZoomRegionList;
Index: magnifier/zoom-region.c
===================================================================
RCS file: /cvs/gnome/gnome-mag/magnifier/zoom-region.c,v
retrieving revision 1.68
diff -u -p -r1.68 zoom-region.c
--- magnifier/zoom-region.c	9 Nov 2006 19:52:32 -0000	1.68
+++ magnifier/zoom-region.c	25 Nov 2006 20:09:42 -0000
@@ -66,6 +66,9 @@ enum {
 	ZOOM_REGION_CONTRASTR_PROP,
 	ZOOM_REGION_CONTRASTG_PROP,
 	ZOOM_REGION_CONTRASTB_PROP,
+	ZOOM_REGION_BRIGHTR_PROP,
+	ZOOM_REGION_BRIGHTG_PROP,
+	ZOOM_REGION_BRIGHTB_PROP,
 	ZOOM_REGION_XSCALE_PROP,
 	ZOOM_REGION_YSCALE_PROP,
 	ZOOM_REGION_BORDERSIZE_PROP,
@@ -1488,13 +1491,20 @@ zoom_region_process_pixbuf (ZoomRegion *
 	guchar *pixels_row;
 
 	gboolean manipulate_contrast = FALSE;
+	gboolean manipulate_brightness = FALSE;
 
 	if (zoom_region->contrast_r != 1 || zoom_region->contrast_g != 1 ||
 	    zoom_region->contrast_b != 1) {
 		manipulate_contrast = TRUE;
 	}
 
-	if (!(manipulate_contrast || zoom_region->invert))
+	if (zoom_region->bright_r != 0 || zoom_region->bright_g != 0 ||
+	    zoom_region->bright_b != 0) {
+		manipulate_brightness = TRUE;
+	}
+
+	if (!manipulate_contrast && !zoom_region->invert &&
+	    !manipulate_brightness)
 		return;
 
 #define CLAMP_UCHAR(v) (t = (v), CLAMP (t, 0, 255))
@@ -1513,6 +1523,17 @@ zoom_region_process_pixbuf (ZoomRegion *
 				pixels_row[2] = CLAMP_UCHAR (pixels_row[2] * zoom_region->contrast_b);
 			}
 
+			if (manipulate_brightness) {
+				/* Set the RED brightness */
+				pixels_row[0] = CLAMP_UCHAR (pixels_row[0] + zoom_region->bright_r * 255);
+				
+				/* Set the GREEN brightness */
+				pixels_row[1] = CLAMP_UCHAR (pixels_row[1] + zoom_region->bright_g * 255);
+
+				/* Set the BLUE brightness */
+				pixels_row[2] = CLAMP_UCHAR (pixels_row[2] + zoom_region->bright_b * 255);
+			}
+
 			if (zoom_region->invert) {
 				pixels_row[0] = ~(pixels_row[0]);
 				pixels_row[1] = ~(pixels_row[1]);
@@ -2240,6 +2261,15 @@ zoom_region_get_property (BonoboProperty
 	case ZOOM_REGION_CONTRASTB_PROP:
 		BONOBO_ARG_SET_FLOAT (arg, zoom_region->contrast_b);
 		break;
+	case ZOOM_REGION_BRIGHTR_PROP:
+		BONOBO_ARG_SET_FLOAT (arg, zoom_region->bright_r);
+		break;
+	case ZOOM_REGION_BRIGHTG_PROP:
+		BONOBO_ARG_SET_FLOAT (arg, zoom_region->bright_g);
+		break;
+	case ZOOM_REGION_BRIGHTB_PROP:
+		BONOBO_ARG_SET_FLOAT (arg, zoom_region->bright_b);
+		break;
 	case ZOOM_REGION_XSCALE_PROP:
 		BONOBO_ARG_SET_FLOAT (arg, zoom_region->xscale);
 		break;
@@ -2354,6 +2384,21 @@ zoom_region_set_property (BonoboProperty
 		zoom_region->contrast_b = BONOBO_ARG_GET_FLOAT (arg);
 		zoom_region_update_current (zoom_region);
 		break;
+	case ZOOM_REGION_BRIGHTR_PROP:
+		zoom_region->bright_r =
+			CLAMP_B_C (BONOBO_ARG_GET_FLOAT (arg));
+		zoom_region_update_current (zoom_region);
+		break;
+	case ZOOM_REGION_BRIGHTG_PROP:
+		zoom_region->bright_g =
+			CLAMP_B_C (BONOBO_ARG_GET_FLOAT (arg));
+		zoom_region_update_current (zoom_region);
+		break;
+	case ZOOM_REGION_BRIGHTB_PROP:
+		zoom_region->bright_b =
+			CLAMP_B_C (BONOBO_ARG_GET_FLOAT (arg));
+		zoom_region_update_current (zoom_region);
+		break;
 	case ZOOM_REGION_XSCALE_PROP:
 		zoom_region->xscale = BONOBO_ARG_GET_FLOAT (arg);
 		zoom_region_update_current (zoom_region);
@@ -2612,6 +2657,53 @@ impl_zoom_region_get_contrast (PortableS
 }
 
 static void
+impl_zoom_region_set_brightness (PortableServer_Servant servant,
+				 const CORBA_float R,
+				 const CORBA_float G,
+				 const CORBA_float B,
+				 CORBA_Environment *ev)
+{
+	ZoomRegion *zoom_region =
+		ZOOM_REGION (bonobo_object_from_servant (servant));
+
+#ifdef ZOOM_REGION_DEBUG
+	g_assert (zoom_region->alive);
+#endif
+	DBG (fprintf (stderr, "Set brightness: \t%f,%f %f\n", R, G, B));
+
+	/* if the contrast values are the same, this is a NOOP */
+	if (zoom_region->bright_r == R &&
+	    zoom_region->bright_g == G &&
+	    zoom_region->bright_b == B)
+		return;
+
+	zoom_region->bright_r = R;
+	zoom_region->bright_g = G;
+	zoom_region->bright_b = B;
+
+	zoom_region_update_current (zoom_region);
+}
+
+static void
+impl_zoom_region_get_brightness (PortableServer_Servant servant,
+				 CORBA_float *R,
+				 CORBA_float *G,
+				 CORBA_float *B,
+				 CORBA_Environment *ev)
+{
+	ZoomRegion *zoom_region =
+		ZOOM_REGION (bonobo_object_from_servant (servant));
+
+#ifdef ZOOM_REGION_DEBUG
+	g_assert (zoom_region->alive);
+#endif
+
+	*R = zoom_region->bright_r;
+	*G = zoom_region->bright_g;
+	*B = zoom_region->bright_b;
+}
+
+static void
 impl_zoom_region_set_roi (PortableServer_Servant servant,
 			  const GNOME_Magnifier_RectBounds *bounds,
 			  CORBA_Environment *ev)
@@ -2900,6 +2992,8 @@ zoom_region_class_init (ZoomRegionClass 
 	epv->dispose = impl_zoom_region_dispose;
 	epv->setContrast = impl_zoom_region_set_contrast;
 	epv->getContrast = impl_zoom_region_get_contrast;
+	epv->setBrightness = impl_zoom_region_set_brightness;
+	epv->getBrightness = impl_zoom_region_get_brightness;
 
 	reset_timing_stats();
 #ifdef DEBUG_CLIENT_CALLS
@@ -3036,6 +3130,45 @@ zoom_region_properties_init (ZoomRegion 
 	bonobo_arg_release (def);
 
 	def = bonobo_arg_new (BONOBO_ARG_FLOAT);
+	BONOBO_ARG_SET_FLOAT (def, 0.0);
+
+	bonobo_property_bag_add (zoom_region->properties,
+				 "red-brightness",
+				 ZOOM_REGION_BRIGHTR_PROP,
+				 BONOBO_ARG_FLOAT,
+				 def,
+				 "red image brightness ratio",
+				 Bonobo_PROPERTY_READABLE |
+				 Bonobo_PROPERTY_WRITEABLE);
+	bonobo_arg_release (def);
+
+	def = bonobo_arg_new (BONOBO_ARG_FLOAT);
+	BONOBO_ARG_SET_FLOAT (def, 0.0);
+
+	bonobo_property_bag_add (zoom_region->properties,
+				 "green-brightness",
+				 ZOOM_REGION_BRIGHTG_PROP,
+				 BONOBO_ARG_FLOAT,
+				 def,
+				 "green image brightness ratio",
+				 Bonobo_PROPERTY_READABLE |
+				 Bonobo_PROPERTY_WRITEABLE);
+	bonobo_arg_release (def);
+
+	def = bonobo_arg_new (BONOBO_ARG_FLOAT);
+	BONOBO_ARG_SET_FLOAT (def, 0.0);
+
+	bonobo_property_bag_add (zoom_region->properties,
+				 "blue-brightness",
+				 ZOOM_REGION_BRIGHTB_PROP,
+				 BONOBO_ARG_FLOAT,
+				 def,
+				 "blue image brightness ratio",
+				 Bonobo_PROPERTY_READABLE |
+				 Bonobo_PROPERTY_WRITEABLE);
+	bonobo_arg_release (def);
+
+	def = bonobo_arg_new (BONOBO_ARG_FLOAT);
 	BONOBO_ARG_SET_FLOAT (def, 2.0);
 
 	bonobo_property_bag_add (zoom_region->properties,
@@ -3219,6 +3352,9 @@ zoom_region_init (ZoomRegion *zoom_regio
 	zoom_region->contrast_r = 1.0;
 	zoom_region->contrast_g = 1.0;
 	zoom_region->contrast_b = 1.0;
+	zoom_region->bright_r = 0.0;
+	zoom_region->bright_g = 0.0;
+	zoom_region->bright_b = 0.0;
 	zoom_region->invert = FALSE;
 	zoom_region->cache_source = FALSE;
 	zoom_region->border_size = 0;
Index: magnifier/zoom-region.h
===================================================================
RCS file: /cvs/gnome/gnome-mag/magnifier/zoom-region.h,v
retrieving revision 1.9
diff -u -p -r1.9 zoom-region.h
--- magnifier/zoom-region.h	24 Jul 2006 23:12:38 -0000	1.9
+++ magnifier/zoom-region.h	25 Nov 2006 20:09:42 -0000
@@ -54,6 +54,9 @@ typedef struct {
 	gfloat contrast_r;
 	gfloat contrast_g;
 	gfloat contrast_b;
+	gfloat bright_r;
+	gfloat bright_g;
+	gfloat bright_b;
 	gint border_size;
 	guint32 border_color; /* A-RGB, 8 bits each, MSB==alpha */
 	gint x_align_policy;  /* TODO: enums here */
Index: test/control-client.c
===================================================================
RCS file: /cvs/gnome/gnome-mag/test/control-client.c,v
retrieving revision 1.14
diff -u -p -r1.14 control-client.c
--- test/control-client.c	23 Nov 2006 19:24:28 -0000	1.14
+++ test/control-client.c	25 Nov 2006 20:09:49 -0000
@@ -266,6 +266,15 @@ int main(int argc, char ** argv){
 		GNOME_Magnifier_ZoomRegion_getContrast (zoom_region, &R, &G, &B, &ev);
 		printf ("ZoomRegion R, G, B: %f, %f, %f\n", R, G, B);
 		break;
+	case 'D':
+		GNOME_Magnifier_ZoomRegion_setBrightness (zoom_region,
+							  atof (argv[2]),
+							  atof (argv[3]),
+							  atof (argv[4]),
+							  &ev);
+		GNOME_Magnifier_ZoomRegion_getBrightness (zoom_region, &R, &G, &B, &ev);
+		printf ("ZoomRegion R, G, B: %f, %f, %f\n", R, G, B);
+		break;
         case 'S':
 		properties = GNOME_Magnifier_Magnifier_getProperties (magnifier, &ev);
 		bonobo_pbclient_set_long (properties, "cursor-size", 200, NULL);
