[Rawstudio-commit] r3031 - in branches/rawstudio-ng-color/plugins: . colorspace-adobergb

Klaus Post klauspost at gmail.com
Mon Jan 18 17:36:27 CET 2010


Author: post
Date: 2010-01-18 17:36:26 +0100 (Mon, 18 Jan 2010)
New Revision: 3031

Added:
   branches/rawstudio-ng-color/plugins/colorspace-adobergb/
   branches/rawstudio-ng-color/plugins/colorspace-adobergb/Makefile.am
   branches/rawstudio-ng-color/plugins/colorspace-adobergb/colorspace-adobergb.c
Modified:
   branches/rawstudio-ng-color/plugins/Makefile.am
Log:
Add internal Adobe RGB (1998) compatible colorspace.

Modified: branches/rawstudio-ng-color/plugins/Makefile.am
===================================================================
--- branches/rawstudio-ng-color/plugins/Makefile.am	2010-01-18 16:29:51 UTC (rev 3030)
+++ branches/rawstudio-ng-color/plugins/Makefile.am	2010-01-18 16:36:26 UTC (rev 3031)
@@ -1,6 +1,7 @@
 SUBDIRS = \
 	basic-render \
 	cache \
+	colorspace-adobergb \
 	colorspace-prophoto \
 	colorspace-srgb \
 	colorspace-transform \


Property changes on: branches/rawstudio-ng-color/plugins/colorspace-adobergb
___________________________________________________________________
Name: svn:ignore
   + Makefile.in
Makefile
.deps


Added: branches/rawstudio-ng-color/plugins/colorspace-adobergb/Makefile.am
===================================================================
--- branches/rawstudio-ng-color/plugins/colorspace-adobergb/Makefile.am	                        (rev 0)
+++ branches/rawstudio-ng-color/plugins/colorspace-adobergb/Makefile.am	2010-01-18 16:36:26 UTC (rev 3031)
@@ -0,0 +1,19 @@
+plugindir = $(libdir)/rawstudio/plugins
+
+AM_CFLAGS =	-Wall
+
+AM_CXXFLAGS = $(AM_CFLAGS)
+
+INCLUDES = \
+	-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+	@PACKAGE_CFLAGS@ \
+	-I../../librawstudio/
+
+lib_LTLIBRARIES = colorspace_adobergb.la
+
+libdir = $(datadir)/rawstudio/plugins/
+
+colorspace_adobergb_la_LIBADD = @PACKAGE_LIBS@
+colorspace_adobergb_la_LDFLAGS = -module -avoid-version
+colorspace_adobergb_la_SOURCES = colorspace-adobergb.c

Added: branches/rawstudio-ng-color/plugins/colorspace-adobergb/colorspace-adobergb.c
===================================================================
--- branches/rawstudio-ng-color/plugins/colorspace-adobergb/colorspace-adobergb.c	                        (rev 0)
+++ branches/rawstudio-ng-color/plugins/colorspace-adobergb/colorspace-adobergb.c	2010-01-18 16:36:26 UTC (rev 3031)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2006-2009 Anders Brander <anders at brander.dk> and 
+ * Anders Kvist <akv at lnxbx.dk>
+ *
+ * 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 details.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+/* Plugin tmpl version 4 */
+
+#include <rawstudio.h>
+#include "config.h"
+#include "gettext.h"
+
+#define RS_TYPE_ADOBERGB (rs_adobe_rgb_type)
+#define RS_ADOBERGB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RS_TYPE_ADOBERGB, RSAdobeRGB))
+#define RS_ADOBERGB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RS_TYPE_ADOBERGB, RSAdobeRGBClass))
+#define RS_IS_ADOBERGB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RS_TYPE_ADOBERGB))
+#define RS_ADOBERGB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RS_TYPE_ADOBERGB, RSAdobeRGBClass))
+
+typedef struct {
+	RSColorSpace parent;
+} RSAdobeRGB;
+
+typedef struct {
+	RSColorSpaceClass parent_class;
+
+	const RSIccProfile *icc_profile;
+} RSAdobeRGBClass;
+
+RS_DEFINE_COLOR_SPACE(rs_adobe_rgb, RSAdobeRGB)
+
+static const RSIccProfile *get_icc_profile(const RSColorSpace *color_space);
+
+G_MODULE_EXPORT void
+rs_plugin_load(RSPlugin *plugin)
+{
+	rs_adobe_rgb_get_type(G_TYPE_MODULE(plugin));
+}
+
+static void
+rs_adobe_rgb_class_init(RSAdobeRGBClass *klass)
+{
+	RSColorSpaceClass *colorclass = RS_COLOR_SPACE_CLASS(klass);
+
+	colorclass->get_icc_profile = get_icc_profile;
+	colorclass->name = "Linear Adobe RGB (1998) Compatible";
+	colorclass->description = _("Print friendly color space, compatible with Adobe RGB (1998)");
+
+	klass->icc_profile = rs_icc_profile_new_from_file(PACKAGE_DATA_DIR "/" PACKAGE "/profiles/compatibleWithAdobeRGB1998.icc");
+}
+
+static void
+rs_adobe_rgb_init(RSAdobeRGB *adobe_rgb)
+{
+	/* Source: http://brucelindbloom.com/Eqn_RGB_XYZ_Matrix.html */
+	/* Internal XYZ transformations are using D50 reference white */
+	const static RS_MATRIX3 to_pcs = {{
+		{ 0.6097559, 0.2052401, 0.1492240 },
+		{ 0.3111242, 0.6256560, 0.0632197 },
+		{ 0.0194811, 0.0608902, 0.7448387 }
+	}};
+
+	rs_color_space_set_matrix_to_pcs(RS_COLOR_SPACE(adobe_rgb), &to_pcs);
+}
+
+static const RSIccProfile *
+get_icc_profile(const RSColorSpace *color_space)
+{
+	RSAdobeRGB *adobe_rgb = RS_ADOBERGB(color_space);
+
+	return RS_ADOBERGB_GET_CLASS(adobe_rgb)->icc_profile;
+}




More information about the Rawstudio-commit mailing list