[gnome-color-manager] Add the start of the calibration framework, which does nothing yet



commit 8224d4c5f584ffc72e69cc7acef23f7739d0d829
Author: Richard Hughes <richard hughsie com>
Date:   Thu Oct 29 14:03:49 2009 +0000

    Add the start of the calibration framework, which does nothing yet

 src/Makefile.am     |    2 +
 src/gcm-calibrate.c |  204 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/gcm-calibrate.h |   74 ++++++++++++++++++
 src/gcm-clut.c      |    3 +-
 4 files changed, 281 insertions(+), 2 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 50f383e..91be2bc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,6 +57,8 @@ gcm_import_CFLAGS =					\
 	$(WARNINGFLAGS_C)
 
 gcm_prefs_SOURCES =					\
+	gcm-calibrate.c					\
+	gcm-calibrate.h					\
 	gcm-prefs.c
 
 gcm_prefs_LDADD =					\
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
new file mode 100644
index 0000000..7dd5cf5
--- /dev/null
+++ b/src/gcm-calibrate.c
@@ -0,0 +1,204 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more calibrate.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:gcm-calibrate
+ * @short_description: Calibration object
+ *
+ * This object allows calibration functionality using ArgyllCMS.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+#include <math.h>
+#include <gio/gio.h>
+
+#include "gcm-calibrate.h"
+
+#include "egg-debug.h"
+
+static void     gcm_calibrate_finalize	(GObject     *object);
+
+#define GCM_CALIBRATE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCM_TYPE_CALIBRATE, GcmCalibratePrivate))
+
+/**
+ * GcmCalibratePrivate:
+ *
+ * Private #GcmCalibrate data
+ **/
+struct _GcmCalibratePrivate
+{
+	gboolean			 is_lcd;
+	gboolean			 is_crt;
+	gchar				*output_name;
+};
+
+enum {
+	PROP_0,
+	PROP_IS_LCD,
+	PROP_IS_CRT,
+	PROP_OUTPUT_NAME,
+	PROP_LAST
+};
+
+G_DEFINE_TYPE (GcmCalibrate, gcm_calibrate, G_TYPE_OBJECT)
+
+/**
+ * gcm_calibrate_run_task:
+ **/
+gboolean
+gcm_calibrate_run_task (GcmCalibrate *calibrate, GcmCalibrateTask task, GError **error)
+{
+	gboolean ret = TRUE;
+
+	g_return_val_if_fail (GCM_IS_CALIBRATE (calibrate), FALSE);
+
+	return ret;
+}
+
+/**
+ * gcm_calibrate_get_property:
+ **/
+static void
+gcm_calibrate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+	GcmCalibrate *calibrate = GCM_CALIBRATE (object);
+	GcmCalibratePrivate *priv = calibrate->priv;
+
+	switch (prop_id) {
+	case PROP_IS_LCD:
+		g_value_set_boolean (value, priv->is_lcd);
+		break;
+	case PROP_IS_CRT:
+		g_value_set_boolean (value, priv->is_crt);
+		break;
+	case PROP_OUTPUT_NAME:
+		g_value_set_string (value, priv->output_name);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+/**
+ * gcm_calibrate_set_property:
+ **/
+static void
+gcm_calibrate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+	GcmCalibrate *calibrate = GCM_CALIBRATE (object);
+	GcmCalibratePrivate *priv = calibrate->priv;
+
+	switch (prop_id) {
+	case PROP_IS_LCD:
+		priv->is_lcd = g_value_get_boolean (value);
+		break;
+	case PROP_IS_CRT:
+		priv->is_crt = g_value_get_boolean (value);
+		break;
+	case PROP_OUTPUT_NAME:
+		g_free (priv->output_name);
+		priv->output_name = g_strdup (g_value_get_string (value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+/**
+ * gcm_calibrate_class_init:
+ **/
+static void
+gcm_calibrate_class_init (GcmCalibrateClass *klass)
+{
+	GParamSpec *pspec;
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	object_class->finalize = gcm_calibrate_finalize;
+	object_class->get_property = gcm_calibrate_get_property;
+	object_class->set_property = gcm_calibrate_set_property;
+
+	/**
+	 * GcmCalibrate:is-lcd:
+	 */
+	pspec = g_param_spec_boolean ("is-lcd", NULL, NULL,
+				      FALSE,
+				      G_PARAM_READWRITE);
+	g_object_class_install_property (object_class, PROP_IS_LCD, pspec);
+
+	/**
+	 * GcmCalibrate:is-crt:
+	 */
+	pspec = g_param_spec_boolean ("is-crt", NULL, NULL,
+				      FALSE,
+				      G_PARAM_READWRITE);
+	g_object_class_install_property (object_class, PROP_IS_CRT, pspec);
+
+	/**
+	 * GcmCalibrate:output-name:
+	 */
+	pspec = g_param_spec_string ("output-name", NULL, NULL,
+				     NULL,
+				     G_PARAM_READWRITE);
+	g_object_class_install_property (object_class, PROP_OUTPUT_NAME, pspec);
+
+	g_type_class_add_private (klass, sizeof (GcmCalibratePrivate));
+}
+
+/**
+ * gcm_calibrate_init:
+ **/
+static void
+gcm_calibrate_init (GcmCalibrate *calibrate)
+{
+	calibrate->priv = GCM_CALIBRATE_GET_PRIVATE (calibrate);
+	calibrate->priv->output_name = NULL;
+}
+
+/**
+ * gcm_calibrate_finalize:
+ **/
+static void
+gcm_calibrate_finalize (GObject *object)
+{
+	GcmCalibrate *calibrate = GCM_CALIBRATE (object);
+	GcmCalibratePrivate *priv = calibrate->priv;
+
+	g_free (priv->output_name);
+
+	G_OBJECT_CLASS (gcm_calibrate_parent_class)->finalize (object);
+}
+
+/**
+ * gcm_calibrate_new:
+ *
+ * Return value: a new GcmCalibrate object.
+ **/
+GcmCalibrate *
+gcm_calibrate_new (void)
+{
+	GcmCalibrate *calibrate;
+	calibrate = g_object_new (GCM_TYPE_CALIBRATE, NULL);
+	return GCM_CALIBRATE (calibrate);
+}
+
diff --git a/src/gcm-calibrate.h b/src/gcm-calibrate.h
new file mode 100644
index 0000000..091d4a1
--- /dev/null
+++ b/src/gcm-calibrate.h
@@ -0,0 +1,74 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more calibrate.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GCM_CALIBRATE_H
+#define __GCM_CALIBRATE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GCM_TYPE_CALIBRATE		(gcm_calibrate_get_type ())
+#define GCM_CALIBRATE(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GCM_TYPE_CALIBRATE, GcmCalibrate))
+#define GCM_CALIBRATE_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GCM_TYPE_CALIBRATE, GcmCalibrateClass))
+#define GCM_IS_CALIBRATE(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GCM_TYPE_CALIBRATE))
+#define GCM_IS_CALIBRATE_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GCM_TYPE_CALIBRATE))
+#define GCM_CALIBRATE_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GCM_TYPE_CALIBRATE, GcmCalibrateClass))
+
+typedef struct _GcmCalibratePrivate	GcmCalibratePrivate;
+typedef struct _GcmCalibrate		GcmCalibrate;
+typedef struct _GcmCalibrateClass	GcmCalibrateClass;
+
+struct _GcmCalibrate
+{
+	 GObject			 parent;
+	 GcmCalibratePrivate		*priv;
+};
+
+struct _GcmCalibrateClass
+{
+	GObjectClass	parent_class;
+	/* padding for future expansion */
+	void (*_gcm_reserved1) (void);
+	void (*_gcm_reserved2) (void);
+	void (*_gcm_reserved3) (void);
+	void (*_gcm_reserved4) (void);
+	void (*_gcm_reserved5) (void);
+};
+
+typedef enum {
+	GCM_CALIBRATE_TASK_NEUTRALISE,
+	GCM_CALIBRATE_TASK_GENERATE_PATCHES,
+	GCM_CALIBRATE_TASK_DRAW_AND_MEASURE,
+	GCM_CALIBRATE_TASK_GENERATE_PROFILE,
+	GCM_CALIBRATE_TASK_UNKNOWN,
+} GcmCalibrateTask;
+
+GType		 gcm_calibrate_get_type		  	(void);
+GcmCalibrate	*gcm_calibrate_new			(void);
+gboolean	 gcm_calibrate_run_task			(GcmCalibrate		*calibrate,
+							 GcmCalibrateTask	 task,
+							 GError			**error);
+
+G_END_DECLS
+
+#endif /* __GCM_CALIBRATE_H */
+
diff --git a/src/gcm-clut.c b/src/gcm-clut.c
index f65fe78..2bc646b 100644
--- a/src/gcm-clut.c
+++ b/src/gcm-clut.c
@@ -379,8 +379,7 @@ gcm_clut_print (GcmClut *clut)
 	}
 }
 
-/**	PROP_GAMMA,
-
+/**
  * gcm_clut_get_property:
  **/
 static void



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