gnome-scan r490 - in trunk: . lib



Author: bersace
Date: Thu Feb 21 18:43:16 2008
New Revision: 490
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=490&view=rev

Log:
Added enhance option. Depends on gegl stress operation in Gegl Operation workshop.


Modified:
   trunk/ChangeLog
   trunk/lib/gnome-scan-job.c
   trunk/lib/gnome-scan-plugin.h
   trunk/lib/gnome-scan-processor-common.c
   trunk/lib/gnome-scan-settings.c
   trunk/lib/gnome-scan-settings.h

Modified: trunk/lib/gnome-scan-job.c
==============================================================================
--- trunk/lib/gnome-scan-job.c	(original)
+++ trunk/lib/gnome-scan-job.c	Thu Feb 21 18:43:16 2008
@@ -347,7 +347,7 @@
 							  gnome_scan_plugin_get_child_nodes (GNOME_SCAN_PLUGIN (snode->data),
 																 priv->gegl_root));
 	}
-
+	
 	/* convert */
 	priv->gegl_convert = gegl_node_new_child(priv->gegl_root,
 											 "operation", "convert-format",

Modified: trunk/lib/gnome-scan-plugin.h
==============================================================================
--- trunk/lib/gnome-scan-plugin.h	(original)
+++ trunk/lib/gnome-scan-plugin.h	Thu Feb 21 18:43:16 2008
@@ -50,13 +50,13 @@
 	
   /* Plugin API */
   void		(* configure)		(GnomeScanPlugin *plugin,
-					 GnomeScanSettings *settings);
+								 GnomeScanSettings *settings);
   GList*	(* get_child_nodes)	(GnomeScanPlugin *plugin,
-					 GeglNode *root);
+								GeglNode *root);
   void		(* configure_frame)	(GnomeScanPlugin *plugin);
   gboolean	(* start_frame)		(GnomeScanPlugin *plugin);
-  gboolean	(* work)		(GnomeScanPlugin *plugin,
-					 gdouble *progress);
+  gboolean	(* work)			(GnomeScanPlugin *plugin,
+								gdouble *progress);
   void		(* end_frame)		(GnomeScanPlugin *plugin);
   void		(* end_scan)		(GnomeScanPlugin *plugin);
 	

Modified: trunk/lib/gnome-scan-processor-common.c
==============================================================================
--- trunk/lib/gnome-scan-processor-common.c	(original)
+++ trunk/lib/gnome-scan-processor-common.c	Thu Feb 21 18:43:16 2008
@@ -29,7 +29,8 @@
 typedef struct _GnomeScanProcessorCommonPrivate GnomeScanProcessorCommonPrivate;
 struct _GnomeScanProcessorCommonPrivate
 {
-	gdouble degrees;
+	gdouble		degrees;
+	gboolean	enhance;
 };
 
 #define GET_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_SCAN_PROCESSOR_COMMON, GnomeScanProcessorCommonPrivate))
@@ -61,6 +62,15 @@
 								G_PARAM_WRITABLE);
 	gs_param_spec_set_widget_type(pspec, GNOME_TYPE_SCAN_PREVIEW_PLUGIN_ROTATION);
 	gnome_scan_plugin_params_add (GNOME_SCAN_PLUGIN (object), pspec);
+	
+	pspec = gs_param_spec_boolean ("enhance", "Automatic color enhancement",
+								   "Color enhancement produce better photos, "
+								   "but take more time to process and can be "
+								   "useless for text.",
+								   GS_PARAM_GROUP_PROCESSING_COMMON,
+								   TRUE,
+								   G_PARAM_WRITABLE);
+	gnome_scan_plugin_params_add (GNOME_SCAN_PLUGIN (object), pspec);
 }
 
 static void
@@ -82,6 +92,7 @@
 {
 	GnomeScanProcessorCommonPrivate *priv = GET_PRIVATE (plugin);
 	priv->degrees = gnome_scan_settings_get_double (settings, "rotation");
+	priv->enhance = gnome_scan_settings_get_boolean (settings, "enhance");
 }
 
 GList*
@@ -89,13 +100,20 @@
 {
 	GnomeScanProcessorCommonPrivate *priv = GET_PRIVATE (plugin);
 	GList* node = NULL;
-	GeglNode *rotate;
+	GeglNode *op;
+	
+	op = gegl_node_new_child(root,
+							 "operation", "rotate",
+							 "degrees", priv->degrees,
+							 NULL);
+	node = g_list_append (node, op);
 	
-	rotate = gegl_node_new_child(root,
-								 "operation", "rotate",
-								 "degrees", priv->degrees,
+	if (priv->enhance) {
+		op = gegl_node_new_child(root,
+								 "operation", "stress",
 								 NULL);
-	node = g_list_append (node, rotate);
+		node = g_list_append (node, op);
+	}
 	
 	return node;
 }

Modified: trunk/lib/gnome-scan-settings.c
==============================================================================
--- trunk/lib/gnome-scan-settings.c	(original)
+++ trunk/lib/gnome-scan-settings.c	Thu Feb 21 18:43:16 2008
@@ -224,6 +224,27 @@
 }
 
 /**
+ * gnome_scan_settings_set_boolean:
+ * @settings: a #GnomeScanSettings
+ * @name: #GParamSpec name
+ * @value: gboolean value
+ * 
+ *
+ * See: gnome_scan_settings_set_transform()
+ **/
+void
+gnome_scan_settings_set_boolean (GnomeScanSettings *settings,
+                             const gchar *name,
+                             gboolean value)
+{
+  g_return_if_fail (GNOME_IS_SCAN_SETTINGS (settings));
+  GValue *v = g_new0 (GValue, 1);
+  g_value_init (v, G_TYPE_BOOLEAN);
+  g_value_set_int (v, value);
+  gnome_scan_settings_set_transform (settings, name, v);
+}
+
+/**
  * gnome_scan_settings_set_enum:
  * @settings: a #GnomeScanSettings
  * @name: #GParamSpec name
@@ -434,6 +455,19 @@
   return val;
 }
 
+gboolean
+gnome_scan_settings_get_boolean (GnomeScanSettings *settings,
+                             const gchar *name)
+{
+  g_return_val_if_fail (GNOME_IS_SCAN_SETTINGS (settings), 0);
+  GValue *v = gnome_scan_settings_get_transformed (settings,
+						   name,  G_TYPE_BOOLEAN);
+  gboolean val = g_value_get_boolean (v);
+  g_value_unset (v);
+  g_free (v);
+  return val;
+}
+
 /**
  * gnome_scan_settings_get_enum:
  * @settings: a #GnomeScanSettings

Modified: trunk/lib/gnome-scan-settings.h
==============================================================================
--- trunk/lib/gnome-scan-settings.h	(original)
+++ trunk/lib/gnome-scan-settings.h	Thu Feb 21 18:43:16 2008
@@ -76,6 +76,10 @@
 void		gnome_scan_settings_set_int		(GnomeScanSettings *settings,
 							 const gchar *name,
 							 gint value);
+							 
+void		gnome_scan_settings_set_boolean		(GnomeScanSettings *settings,
+							 const gchar *name,
+							 gboolean value);
 
 void		gnome_scan_settings_set_enum		(GnomeScanSettings *settings,
 							 const gchar *name,
@@ -110,6 +114,9 @@
 
 gint		gnome_scan_settings_get_int		(GnomeScanSettings *settings,
 							 const gchar *name);
+							 
+gboolean		gnome_scan_settings_get_boolean	(GnomeScanSettings *settings,
+							 const gchar *name);
 
 gint		gnome_scan_settings_get_enum		(GnomeScanSettings *settings,
 							 const gchar *name,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]