[cheese/videobalance] Implement contrast control
- From: Filippo Argiolas <fargiolas src gnome org>
- To: svn-commits-list gnome org
- Subject: [cheese/videobalance] Implement contrast control
- Date: Thu, 23 Apr 2009 12:31:36 -0400 (EDT)
commit 876ea9dd5b76cbe1cf32d3037344119292f7eb77
Author: Filippo Argiolas <filippo argiolas gmail com>
Date: Thu Apr 23 17:32:52 2009 +0200
Implement contrast control
Actually implement the widget for contrast adjustment, add its
gconf property and the correspondent schema
---
data/cheese.schemas.in | 13 ++++++++++++-
src/cheese-gconf.c | 20 ++++++++++++++++++++
src/cheese-gconf.h | 1 +
src/cheese-prefs-dialog.c | 10 ++++++++++
src/cheese-window.c | 6 +++++-
5 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/data/cheese.schemas.in b/data/cheese.schemas.in
index 2657868..4c5379e 100644
--- a/data/cheese.schemas.in
+++ b/data/cheese.schemas.in
@@ -73,7 +73,18 @@
<default>0</default>
<locale name="C">
<short>Picture brightness</short>
- <long>Brightness correction on the image coming from the webcam</long>
+ <long>Adjusts brightness level of the picture coming from the webcam</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/cheese/contrast</key>
+ <applyto>/apps/cheese/contrast</applyto>
+ <owner>cheese</owner>
+ <type>float</type>
+ <default>1</default>
+ <locale name="C">
+ <short>Picture contrast</short>
+ <long>Adjusts contrast level of the picture coming from the webcam</long>
</locale>
</schema>
diff --git a/src/cheese-gconf.c b/src/cheese-gconf.c
index c72e0cd..08c22be 100644
--- a/src/cheese-gconf.c
+++ b/src/cheese-gconf.c
@@ -118,6 +118,11 @@ cheese_gconf_get_property (GObject *object, guint prop_id, GValue *value,
CHEESE_GCONF_PREFIX "/brightness",
NULL));
break;
+ case GCONF_PROP_CONTRAST:
+ g_value_set_double (value, gconf_client_get_float (priv->client,
+ CHEESE_GCONF_PREFIX "/contrast",
+ NULL));
+ break;
case GCONF_PROP_VIDEO_PATH:
g_value_set_string (value, gconf_client_get_string (priv->client,
CHEESE_GCONF_PREFIX "/video_path",
@@ -224,6 +229,12 @@ cheese_gconf_set_property (GObject *object, guint prop_id, const GValue *value,
g_value_get_double (value),
NULL);
break;
+ case GCONF_PROP_CONTRAST:
+ gconf_client_set_float (priv->client,
+ CHEESE_GCONF_PREFIX "/contrast",
+ g_value_get_double (value),
+ NULL);
+ break;
case GCONF_PROP_VIDEO_PATH:
gconf_client_set_string (priv->client,
CHEESE_GCONF_PREFIX "/video_path",
@@ -316,6 +327,15 @@ cheese_gconf_class_init (CheeseGConfClass *klass)
0.0,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, GCONF_PROP_CONTRAST,
+ g_param_spec_double ("gconf_prop_contrast",
+ NULL,
+ NULL,
+ 0,
+ G_MAXFLOAT,
+ 1.0,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (object_class, GCONF_PROP_VIDEO_PATH,
g_param_spec_string ("gconf_prop_video_path",
NULL,
diff --git a/src/cheese-gconf.h b/src/cheese-gconf.h
index 37cbfc3..647aaea 100644
--- a/src/cheese-gconf.h
+++ b/src/cheese-gconf.h
@@ -48,6 +48,7 @@ enum
GCONF_PROP_X_RESOLUTION,
GCONF_PROP_Y_RESOLUTION,
GCONF_PROP_BRIGHTNESS,
+ GCONF_PROP_CONTRAST,
GCONF_PROP_VIDEO_PATH,
GCONF_PROP_PHOTO_PATH,
GCONF_PROP_ENABLE_DELETE
diff --git a/src/cheese-prefs-dialog.c b/src/cheese-prefs-dialog.c
index 2173cec..e3ac2ec 100644
--- a/src/cheese-prefs-dialog.c
+++ b/src/cheese-prefs-dialog.c
@@ -26,6 +26,7 @@ typedef struct
GtkWidget *resolution_combo_box;
GtkWidget *webcam_combo_box;
GtkWidget *brightness_scale;
+ GtkWidget *contrast_scale;
GtkWidget *parent;
CheeseWebcam *webcam;
@@ -57,6 +58,8 @@ cheese_prefs_dialog_create_dialog (CheesePrefsDialog *prefs_dialog)
"webcam_combo_box"));
prefs_dialog->brightness_scale = GTK_WIDGET (gtk_builder_get_object (builder,
"brightness_scale"));
+ prefs_dialog->contrast_scale = GTK_WIDGET (gtk_builder_get_object (builder,
+ "contrast_scale"));
gtk_window_set_transient_for (GTK_WINDOW (prefs_dialog->cheese_prefs_dialog),
GTK_WINDOW (prefs_dialog->parent));
@@ -108,6 +111,7 @@ cheese_prefs_dialog_setup_widgets (CheesePrefsDialog *prefs_dialog)
CheesePrefsWidget *resolution_widget;
CheesePrefsWidget *webcam_widget;
CheesePrefsWidget *brightness_widget;
+ CheesePrefsWidget *contrast_widget;
resolution_widget = CHEESE_PREFS_WIDGET (cheese_prefs_resolution_combo_new (prefs_dialog->resolution_combo_box,
prefs_dialog->webcam,
@@ -134,6 +138,12 @@ cheese_prefs_dialog_setup_widgets (CheesePrefsDialog *prefs_dialog)
cheese_prefs_dialog_widgets_add (prefs_dialog->widgets, brightness_widget);
+ contrast_widget = CHEESE_PREFS_WIDGET (cheese_prefs_balance_scale_new (prefs_dialog->contrast_scale,
+ prefs_dialog->webcam, "contrast",
+ "gconf_prop_contrast"));
+
+ cheese_prefs_dialog_widgets_add (prefs_dialog->widgets, contrast_widget);
+
cheese_prefs_dialog_widgets_synchronize (prefs_dialog->widgets);
}
diff --git a/src/cheese-window.c b/src/cheese-window.c
index 91b81a6..9e16025 100644
--- a/src/cheese-window.c
+++ b/src/cheese-window.c
@@ -1853,6 +1853,7 @@ setup_camera (CheeseWindow *cheese_window)
int x_resolution;
int y_resolution;
gdouble brightness;
+ gdouble contrast;
GtkWidget *message_area;
GError *error;
@@ -1861,7 +1862,9 @@ setup_camera (CheeseWindow *cheese_window)
"gconf_prop_x_resolution", &x_resolution,
"gconf_prop_y_resolution", &y_resolution,
"gconf_prop_webcam", &webcam_device,
- "gconf_prop_brightness", &brightness, NULL);
+ "gconf_prop_brightness", &brightness,
+ "gconf_prop_contrast", &contrast,
+ NULL);
gdk_threads_enter ();
cheese_window->webcam = cheese_webcam_new (cheese_window->screen,
@@ -1913,6 +1916,7 @@ setup_camera (CheeseWindow *cheese_window)
cheese_effect_chooser_get_selection (CHEESE_EFFECT_CHOOSER (cheese_window->effect_chooser)));
cheese_webcam_set_balance_property (cheese_window->webcam, "brightness", brightness);
+ cheese_webcam_set_balance_property (cheese_window->webcam, "contrast", contrast);
cheese_webcam_play (cheese_window->webcam);
gdk_threads_enter ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]