modules: remove the "lcms" and "proof" display filters
This commit is contained in:
@ -38,8 +38,6 @@ lib_LTLIBRARIES = \
|
|||||||
libdisplay-filter-color-blind.la \
|
libdisplay-filter-color-blind.la \
|
||||||
libdisplay-filter-gamma.la \
|
libdisplay-filter-gamma.la \
|
||||||
libdisplay-filter-high-contrast.la \
|
libdisplay-filter-high-contrast.la \
|
||||||
libdisplay-filter-lcms.la \
|
|
||||||
libdisplay-filter-proof.la \
|
|
||||||
$(controller_midi_module) \
|
$(controller_midi_module) \
|
||||||
$(controller_linux_input_module) \
|
$(controller_linux_input_module) \
|
||||||
$(controller_dx_dinput_module)
|
$(controller_dx_dinput_module)
|
||||||
@ -75,14 +73,6 @@ libdisplay_filter_high_contrast_la_SOURCES = display-filter-high-contrast.c
|
|||||||
libdisplay_filter_high_contrast_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
libdisplay_filter_high_contrast_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
||||||
libdisplay_filter_high_contrast_la_LIBADD = $(display_filter_libadd)
|
libdisplay_filter_high_contrast_la_LIBADD = $(display_filter_libadd)
|
||||||
|
|
||||||
libdisplay_filter_lcms_la_SOURCES = display-filter-lcms.c
|
|
||||||
libdisplay_filter_lcms_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
|
||||||
libdisplay_filter_lcms_la_LIBADD = $(display_filter_libadd)
|
|
||||||
|
|
||||||
libdisplay_filter_proof_la_SOURCES = display-filter-proof.c
|
|
||||||
libdisplay_filter_proof_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
|
||||||
libdisplay_filter_proof_la_LIBADD = $(display_filter_libadd)
|
|
||||||
|
|
||||||
libcontroller_linux_input_la_SOURCES = \
|
libcontroller_linux_input_la_SOURCES = \
|
||||||
gimpinputdevicestore-gudev.c \
|
gimpinputdevicestore-gudev.c \
|
||||||
gimpinputdevicestore.h \
|
gimpinputdevicestore.h \
|
||||||
|
@ -1,381 +0,0 @@
|
|||||||
/* GIMP - The GNU Image Manipulation Program
|
|
||||||
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
|
|
||||||
*
|
|
||||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <gegl.h>
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#ifdef GDK_WINDOWING_QUARTZ
|
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
|
||||||
#include <CoreServices/CoreServices.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "libgimpbase/gimpbase.h"
|
|
||||||
#include "libgimpcolor/gimpcolor.h"
|
|
||||||
#include "libgimpconfig/gimpconfig.h"
|
|
||||||
#include "libgimpmath/gimpmath.h"
|
|
||||||
#include "libgimpmodule/gimpmodule.h"
|
|
||||||
#include "libgimpwidgets/gimpwidgets.h"
|
|
||||||
|
|
||||||
#include "libgimp/libgimp-intl.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define CDISPLAY_TYPE_LCMS (cdisplay_lcms_get_type ())
|
|
||||||
#define CDISPLAY_LCMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CDISPLAY_TYPE_LCMS, CdisplayLcms))
|
|
||||||
#define CDISPLAY_LCMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CDISPLAY_TYPE_LCMS, CdisplayLcmsClass))
|
|
||||||
#define CDISPLAY_IS_LCMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CDISPLAY_TYPE_LCMS))
|
|
||||||
#define CDISPLAY_IS_LCMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CDISPLAY_TYPE_LCMS))
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _CdisplayLcms CdisplayLcms;
|
|
||||||
typedef struct _CdisplayLcmsClass CdisplayLcmsClass;
|
|
||||||
|
|
||||||
struct _CdisplayLcms
|
|
||||||
{
|
|
||||||
GimpColorDisplay parent_instance;
|
|
||||||
|
|
||||||
GimpColorTransform *transform;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _CdisplayLcmsClass
|
|
||||||
{
|
|
||||||
GimpColorDisplayClass parent_instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
GType cdisplay_lcms_get_type (void);
|
|
||||||
|
|
||||||
static void cdisplay_lcms_finalize (GObject *object);
|
|
||||||
|
|
||||||
static GtkWidget * cdisplay_lcms_configure (GimpColorDisplay *display);
|
|
||||||
static void cdisplay_lcms_convert_buffer (GimpColorDisplay *display,
|
|
||||||
GeglBuffer *buffer,
|
|
||||||
GeglRectangle *area);
|
|
||||||
static void cdisplay_lcms_changed (GimpColorDisplay *display);
|
|
||||||
|
|
||||||
static GimpColorProfile * cdisplay_lcms_get_display_profile (CdisplayLcms *lcms);
|
|
||||||
|
|
||||||
static void cdisplay_lcms_attach_labelled (GtkTable *table,
|
|
||||||
gint row,
|
|
||||||
const gchar *text,
|
|
||||||
GtkWidget *widget);
|
|
||||||
static void cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
|
|
||||||
const gchar *name);
|
|
||||||
static void cdisplay_lcms_notify_profile (GObject *config,
|
|
||||||
GParamSpec *pspec,
|
|
||||||
CdisplayLcms *lcms);
|
|
||||||
|
|
||||||
|
|
||||||
static const GimpModuleInfo cdisplay_lcms_info =
|
|
||||||
{
|
|
||||||
GIMP_MODULE_ABI_VERSION,
|
|
||||||
N_("Color management display filter using ICC color profiles"),
|
|
||||||
"Sven Neumann",
|
|
||||||
"v0.3",
|
|
||||||
"(c) 2005 - 2007, released under the GPL",
|
|
||||||
"2005 - 2007"
|
|
||||||
};
|
|
||||||
|
|
||||||
G_DEFINE_DYNAMIC_TYPE (CdisplayLcms, cdisplay_lcms,
|
|
||||||
GIMP_TYPE_COLOR_DISPLAY)
|
|
||||||
|
|
||||||
G_MODULE_EXPORT const GimpModuleInfo *
|
|
||||||
gimp_module_query (GTypeModule *module)
|
|
||||||
{
|
|
||||||
return &cdisplay_lcms_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_MODULE_EXPORT gboolean
|
|
||||||
gimp_module_register (GTypeModule *module)
|
|
||||||
{
|
|
||||||
cdisplay_lcms_register_type (module);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_lcms_class_init (CdisplayLcmsClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
||||||
GimpColorDisplayClass *display_class = GIMP_COLOR_DISPLAY_CLASS (klass);
|
|
||||||
|
|
||||||
object_class->finalize = cdisplay_lcms_finalize;
|
|
||||||
|
|
||||||
display_class->name = _("Color Management");
|
|
||||||
display_class->help_id = "gimp-colordisplay-lcms";
|
|
||||||
display_class->icon_name = GIMP_ICON_DISPLAY_FILTER_LCMS;
|
|
||||||
|
|
||||||
display_class->configure = cdisplay_lcms_configure;
|
|
||||||
display_class->convert_buffer = cdisplay_lcms_convert_buffer;
|
|
||||||
display_class->changed = cdisplay_lcms_changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_lcms_class_finalize (CdisplayLcmsClass *klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_lcms_init (CdisplayLcms *lcms)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_lcms_finalize (GObject *object)
|
|
||||||
{
|
|
||||||
CdisplayLcms *lcms = CDISPLAY_LCMS (object);
|
|
||||||
|
|
||||||
if (lcms->transform)
|
|
||||||
{
|
|
||||||
g_object_unref (lcms->transform);
|
|
||||||
lcms->transform = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (cdisplay_lcms_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget *
|
|
||||||
cdisplay_lcms_configure (GimpColorDisplay *display)
|
|
||||||
{
|
|
||||||
CdisplayLcms *lcms = CDISPLAY_LCMS (display);
|
|
||||||
GObject *config = G_OBJECT (gimp_color_display_get_config (display));
|
|
||||||
GtkWidget *vbox;
|
|
||||||
GtkWidget *hint;
|
|
||||||
GtkWidget *table;
|
|
||||||
GtkWidget *label;
|
|
||||||
gint row = 0;
|
|
||||||
|
|
||||||
if (! config)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
|
||||||
|
|
||||||
hint = gimp_hint_box_new (_("This filter takes its configuration "
|
|
||||||
"from the Color Management section "
|
|
||||||
"in the Preferences dialog."));
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), hint, FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show (hint);
|
|
||||||
|
|
||||||
table = gtk_table_new (5, 2, FALSE);
|
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
|
||||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 12);
|
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show (table);
|
|
||||||
|
|
||||||
cdisplay_lcms_attach_labelled (GTK_TABLE (table), row++,
|
|
||||||
_("Mode of operation:"),
|
|
||||||
gimp_prop_enum_label_new (config, "mode"));
|
|
||||||
|
|
||||||
label = gtk_label_new (NULL);
|
|
||||||
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
|
|
||||||
g_object_set_data (G_OBJECT (lcms), "rgb-profile", label);
|
|
||||||
cdisplay_lcms_attach_labelled (GTK_TABLE (table), row++,
|
|
||||||
_("Image profile:"),
|
|
||||||
label);
|
|
||||||
cdisplay_lcms_update_profile_label (lcms, "rgb-profile");
|
|
||||||
|
|
||||||
label = gtk_label_new (NULL);
|
|
||||||
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
|
|
||||||
g_object_set_data (G_OBJECT (lcms), "display-profile", label);
|
|
||||||
cdisplay_lcms_attach_labelled (GTK_TABLE (table), row++,
|
|
||||||
_("Monitor profile:"),
|
|
||||||
label);
|
|
||||||
cdisplay_lcms_update_profile_label (lcms, "display-profile");
|
|
||||||
|
|
||||||
label = gtk_label_new (NULL);
|
|
||||||
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
|
|
||||||
g_object_set_data (G_OBJECT (lcms), "printer-profile", label);
|
|
||||||
cdisplay_lcms_attach_labelled (GTK_TABLE (table), row++,
|
|
||||||
_("Print simulation profile:"),
|
|
||||||
label);
|
|
||||||
cdisplay_lcms_update_profile_label (lcms, "printer-profile");
|
|
||||||
|
|
||||||
g_signal_connect_object (config, "notify",
|
|
||||||
G_CALLBACK (cdisplay_lcms_notify_profile),
|
|
||||||
lcms, 0);
|
|
||||||
|
|
||||||
return vbox;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_lcms_convert_buffer (GimpColorDisplay *display,
|
|
||||||
GeglBuffer *buffer,
|
|
||||||
GeglRectangle *area)
|
|
||||||
{
|
|
||||||
CdisplayLcms *lcms = CDISPLAY_LCMS (display);
|
|
||||||
|
|
||||||
if (lcms->transform)
|
|
||||||
gimp_color_transform_process_buffer (lcms->transform,
|
|
||||||
buffer, area,
|
|
||||||
buffer, area);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_lcms_changed (GimpColorDisplay *display)
|
|
||||||
{
|
|
||||||
CdisplayLcms *lcms = CDISPLAY_LCMS (display);
|
|
||||||
GtkWidget *widget = NULL;
|
|
||||||
GimpColorConfig *config;
|
|
||||||
GimpColorManaged *managed;
|
|
||||||
GimpColorProfile *src_profile;
|
|
||||||
|
|
||||||
if (lcms->transform)
|
|
||||||
{
|
|
||||||
g_object_unref (lcms->transform);
|
|
||||||
lcms->transform = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
config = gimp_color_display_get_config (display);
|
|
||||||
managed = gimp_color_display_get_managed (display);
|
|
||||||
|
|
||||||
if (! config || ! managed)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (GTK_IS_WIDGET (managed))
|
|
||||||
widget = gtk_widget_get_toplevel (GTK_WIDGET (managed));
|
|
||||||
|
|
||||||
src_profile = gimp_color_managed_get_color_profile (managed);
|
|
||||||
|
|
||||||
lcms->transform =
|
|
||||||
gimp_widget_get_color_transform (widget,
|
|
||||||
config, src_profile,
|
|
||||||
babl_format ("R'G'B'A float"),
|
|
||||||
babl_format ("R'G'B'A float"));
|
|
||||||
}
|
|
||||||
|
|
||||||
static GimpColorProfile *
|
|
||||||
cdisplay_lcms_get_display_profile (CdisplayLcms *lcms)
|
|
||||||
{
|
|
||||||
GimpColorConfig *config;
|
|
||||||
GimpColorManaged *managed;
|
|
||||||
GtkWidget *widget = NULL;
|
|
||||||
GimpColorProfile *profile = NULL;
|
|
||||||
|
|
||||||
config = gimp_color_display_get_config (GIMP_COLOR_DISPLAY (lcms));
|
|
||||||
managed = gimp_color_display_get_managed (GIMP_COLOR_DISPLAY (lcms));
|
|
||||||
|
|
||||||
if (GTK_IS_WIDGET (managed))
|
|
||||||
widget = gtk_widget_get_toplevel (GTK_WIDGET (managed));
|
|
||||||
|
|
||||||
if (gimp_color_config_get_display_profile_from_gdk (config))
|
|
||||||
profile = gimp_widget_get_color_profile (widget);
|
|
||||||
|
|
||||||
if (! profile)
|
|
||||||
profile = gimp_color_config_get_display_color_profile (config, NULL);
|
|
||||||
|
|
||||||
return profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_lcms_attach_labelled (GtkTable *table,
|
|
||||||
gint row,
|
|
||||||
const gchar *text,
|
|
||||||
GtkWidget *widget)
|
|
||||||
{
|
|
||||||
GtkWidget *label;
|
|
||||||
|
|
||||||
label = g_object_new (GTK_TYPE_LABEL,
|
|
||||||
"label", text,
|
|
||||||
"xalign", 1.0,
|
|
||||||
"yalign", 0.5,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
gimp_label_set_attributes (GTK_LABEL (label),
|
|
||||||
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
|
|
||||||
-1);
|
|
||||||
gtk_table_attach (table, label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
|
|
||||||
gtk_widget_show (label);
|
|
||||||
|
|
||||||
if (GTK_IS_LABEL (widget))
|
|
||||||
gtk_label_set_xalign (GTK_LABEL (widget), 0.0);
|
|
||||||
|
|
||||||
gtk_table_attach (table, widget, 1, 2, row, row + 1,
|
|
||||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
|
||||||
gtk_widget_show (widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
|
|
||||||
const gchar *name)
|
|
||||||
{
|
|
||||||
GimpColorConfig *config;
|
|
||||||
GimpColorManaged *managed;
|
|
||||||
GtkWidget *label;
|
|
||||||
GimpColorProfile *profile = NULL;
|
|
||||||
const gchar *text;
|
|
||||||
const gchar *tooltip;
|
|
||||||
|
|
||||||
config = gimp_color_display_get_config (GIMP_COLOR_DISPLAY (lcms));
|
|
||||||
managed = gimp_color_display_get_managed (GIMP_COLOR_DISPLAY (lcms));
|
|
||||||
|
|
||||||
label = g_object_get_data (G_OBJECT (lcms), name);
|
|
||||||
|
|
||||||
if (! label)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (strcmp (name, "rgb-profile") == 0)
|
|
||||||
{
|
|
||||||
profile = gimp_color_managed_get_color_profile (managed);
|
|
||||||
|
|
||||||
if (profile)
|
|
||||||
g_object_ref (profile);
|
|
||||||
}
|
|
||||||
else if (g_str_has_prefix (name, "display-profile"))
|
|
||||||
{
|
|
||||||
profile = cdisplay_lcms_get_display_profile (lcms);
|
|
||||||
}
|
|
||||||
else if (strcmp (name, "printer-profile") == 0)
|
|
||||||
{
|
|
||||||
profile = gimp_color_config_get_simulation_color_profile (config, NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_return_if_reached ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (profile)
|
|
||||||
{
|
|
||||||
text = gimp_color_profile_get_label (profile);
|
|
||||||
tooltip = gimp_color_profile_get_summary (profile);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
text = _("None");
|
|
||||||
tooltip = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_label_set_text (GTK_LABEL (label), text);
|
|
||||||
gimp_help_set_help_data (label, tooltip, NULL);
|
|
||||||
|
|
||||||
if (profile)
|
|
||||||
g_object_unref (profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_lcms_notify_profile (GObject *config,
|
|
||||||
GParamSpec *pspec,
|
|
||||||
CdisplayLcms *lcms)
|
|
||||||
{
|
|
||||||
cdisplay_lcms_update_profile_label (lcms, pspec->name);
|
|
||||||
}
|
|
@ -1,382 +0,0 @@
|
|||||||
/* GIMP - The GNU Image Manipulation Program
|
|
||||||
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
|
|
||||||
*
|
|
||||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <gegl.h>
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include "libgimpbase/gimpbase.h"
|
|
||||||
#include "libgimpcolor/gimpcolor.h"
|
|
||||||
#include "libgimpconfig/gimpconfig.h"
|
|
||||||
#include "libgimpmath/gimpmath.h"
|
|
||||||
#include "libgimpmodule/gimpmodule.h"
|
|
||||||
#include "libgimpwidgets/gimpwidgets.h"
|
|
||||||
|
|
||||||
#include "libgimp/libgimp-intl.h"
|
|
||||||
|
|
||||||
#define CDISPLAY_TYPE_PROOF (cdisplay_proof_get_type ())
|
|
||||||
#define CDISPLAY_PROOF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CDISPLAY_TYPE_PROOF, CdisplayProof))
|
|
||||||
#define CDISPLAY_PROOF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CDISPLAY_TYPE_PROOF, CdisplayProofClass))
|
|
||||||
#define CDISPLAY_IS_PROOF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CDISPLAY_TYPE_PROOF))
|
|
||||||
#define CDISPLAY_IS_PROOF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CDISPLAY_TYPE_PROOF))
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _CdisplayProof CdisplayProof;
|
|
||||||
typedef struct _CdisplayProofClass CdisplayProofClass;
|
|
||||||
|
|
||||||
struct _CdisplayProof
|
|
||||||
{
|
|
||||||
GimpColorDisplay parent_instance;
|
|
||||||
|
|
||||||
gint intent;
|
|
||||||
gboolean bpc;
|
|
||||||
gchar *profile;
|
|
||||||
|
|
||||||
GimpColorTransform *transform;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _CdisplayProofClass
|
|
||||||
{
|
|
||||||
GimpColorDisplayClass parent_instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
PROP_0,
|
|
||||||
PROP_INTENT,
|
|
||||||
PROP_BPC,
|
|
||||||
PROP_PROFILE
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static GType cdisplay_proof_get_type (void);
|
|
||||||
|
|
||||||
static void cdisplay_proof_finalize (GObject *object);
|
|
||||||
static void cdisplay_proof_get_property (GObject *object,
|
|
||||||
guint property_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec);
|
|
||||||
static void cdisplay_proof_set_property (GObject *object,
|
|
||||||
guint property_id,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec);
|
|
||||||
|
|
||||||
|
|
||||||
static void cdisplay_proof_convert_buffer (GimpColorDisplay *display,
|
|
||||||
GeglBuffer *buffer,
|
|
||||||
GeglRectangle *area);
|
|
||||||
static GtkWidget * cdisplay_proof_configure (GimpColorDisplay *display);
|
|
||||||
static void cdisplay_proof_changed (GimpColorDisplay *display);
|
|
||||||
|
|
||||||
|
|
||||||
static const GimpModuleInfo cdisplay_proof_info =
|
|
||||||
{
|
|
||||||
GIMP_MODULE_ABI_VERSION,
|
|
||||||
N_("Color proof filter using ICC color profile"),
|
|
||||||
"Banlu Kemiyatorn <id@project-ile.net>",
|
|
||||||
"v0.1",
|
|
||||||
"(c) 2002-2003, released under the GPL",
|
|
||||||
"November 14, 2003"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_DYNAMIC_TYPE (CdisplayProof, cdisplay_proof,
|
|
||||||
GIMP_TYPE_COLOR_DISPLAY)
|
|
||||||
|
|
||||||
|
|
||||||
G_MODULE_EXPORT const GimpModuleInfo *
|
|
||||||
gimp_module_query (GTypeModule *module)
|
|
||||||
{
|
|
||||||
return &cdisplay_proof_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_MODULE_EXPORT gboolean
|
|
||||||
gimp_module_register (GTypeModule *module)
|
|
||||||
{
|
|
||||||
cdisplay_proof_register_type (module);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_proof_class_init (CdisplayProofClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
||||||
GimpColorDisplayClass *display_class = GIMP_COLOR_DISPLAY_CLASS (klass);
|
|
||||||
|
|
||||||
object_class->finalize = cdisplay_proof_finalize;
|
|
||||||
object_class->get_property = cdisplay_proof_get_property;
|
|
||||||
object_class->set_property = cdisplay_proof_set_property;
|
|
||||||
|
|
||||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_INTENT,
|
|
||||||
"intent",
|
|
||||||
_("Intent"),
|
|
||||||
NULL,
|
|
||||||
GIMP_TYPE_COLOR_RENDERING_INTENT,
|
|
||||||
GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
|
|
||||||
0);
|
|
||||||
|
|
||||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_BPC,
|
|
||||||
"black-point-compensation",
|
|
||||||
_("Black point compensation"),
|
|
||||||
NULL,
|
|
||||||
FALSE,
|
|
||||||
0);
|
|
||||||
|
|
||||||
GIMP_CONFIG_PROP_PATH (object_class, PROP_PROFILE,
|
|
||||||
"profile",
|
|
||||||
_("Profile"),
|
|
||||||
NULL,
|
|
||||||
GIMP_CONFIG_PATH_FILE, NULL,
|
|
||||||
0);
|
|
||||||
|
|
||||||
display_class->name = _("Color Proof");
|
|
||||||
display_class->help_id = "gimp-colordisplay-proof";
|
|
||||||
display_class->icon_name = GIMP_ICON_DISPLAY_FILTER_PROOF;
|
|
||||||
|
|
||||||
display_class->convert_buffer = cdisplay_proof_convert_buffer;
|
|
||||||
display_class->configure = cdisplay_proof_configure;
|
|
||||||
display_class->changed = cdisplay_proof_changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_proof_class_finalize (CdisplayProofClass *klass)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_proof_init (CdisplayProof *proof)
|
|
||||||
{
|
|
||||||
proof->transform = NULL;
|
|
||||||
proof->profile = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_proof_finalize (GObject *object)
|
|
||||||
{
|
|
||||||
CdisplayProof *proof = CDISPLAY_PROOF (object);
|
|
||||||
|
|
||||||
if (proof->profile)
|
|
||||||
{
|
|
||||||
g_free (proof->profile);
|
|
||||||
proof->profile = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (proof->transform)
|
|
||||||
{
|
|
||||||
g_object_unref (proof->transform);
|
|
||||||
proof->transform = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (cdisplay_proof_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_proof_get_property (GObject *object,
|
|
||||||
guint property_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
CdisplayProof *proof = CDISPLAY_PROOF (object);
|
|
||||||
|
|
||||||
switch (property_id)
|
|
||||||
{
|
|
||||||
case PROP_INTENT:
|
|
||||||
g_value_set_enum (value, proof->intent);
|
|
||||||
break;
|
|
||||||
case PROP_BPC:
|
|
||||||
g_value_set_boolean (value, proof->bpc);
|
|
||||||
break;
|
|
||||||
case PROP_PROFILE:
|
|
||||||
g_value_set_string (value, proof->profile);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_proof_set_property (GObject *object,
|
|
||||||
guint property_id,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
CdisplayProof *proof = CDISPLAY_PROOF (object);
|
|
||||||
|
|
||||||
switch (property_id)
|
|
||||||
{
|
|
||||||
case PROP_INTENT:
|
|
||||||
proof->intent = g_value_get_enum (value);
|
|
||||||
break;
|
|
||||||
case PROP_BPC:
|
|
||||||
proof->bpc = g_value_get_boolean (value);
|
|
||||||
break;
|
|
||||||
case PROP_PROFILE:
|
|
||||||
g_free (proof->profile);
|
|
||||||
proof->profile = g_value_dup_string (value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
gimp_color_display_changed (GIMP_COLOR_DISPLAY (proof));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_proof_convert_buffer (GimpColorDisplay *display,
|
|
||||||
GeglBuffer *buffer,
|
|
||||||
GeglRectangle *area)
|
|
||||||
{
|
|
||||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
|
||||||
|
|
||||||
if (proof->transform)
|
|
||||||
gimp_color_transform_process_buffer (proof->transform,
|
|
||||||
buffer, area,
|
|
||||||
buffer, area);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_proof_profile_changed (GtkWidget *combo,
|
|
||||||
CdisplayProof *proof)
|
|
||||||
{
|
|
||||||
GFile *file;
|
|
||||||
gchar *path = NULL;
|
|
||||||
|
|
||||||
file = gimp_color_profile_combo_box_get_active_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo));
|
|
||||||
|
|
||||||
if (file)
|
|
||||||
{
|
|
||||||
path = gimp_file_get_config_path (file, NULL);
|
|
||||||
g_object_unref (file);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_set (proof,
|
|
||||||
"profile", path,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
g_free (path);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget *
|
|
||||||
cdisplay_proof_configure (GimpColorDisplay *display)
|
|
||||||
{
|
|
||||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
|
||||||
GtkWidget *table;
|
|
||||||
GtkWidget *combo;
|
|
||||||
GtkWidget *toggle;
|
|
||||||
GtkWidget *dialog;
|
|
||||||
gchar *history;
|
|
||||||
|
|
||||||
table = gtk_table_new (3, 2, FALSE);
|
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
|
||||||
|
|
||||||
dialog = gimp_color_profile_chooser_dialog_new (_("Choose an ICC Color Profile"),
|
|
||||||
NULL,
|
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN);
|
|
||||||
|
|
||||||
history = gimp_personal_rc_file ("profilerc");
|
|
||||||
combo = gimp_color_profile_combo_box_new (dialog, history);
|
|
||||||
g_free (history);
|
|
||||||
|
|
||||||
g_signal_connect (combo, "changed",
|
|
||||||
G_CALLBACK (cdisplay_proof_profile_changed),
|
|
||||||
proof);
|
|
||||||
|
|
||||||
if (proof->profile)
|
|
||||||
{
|
|
||||||
GFile *file = gimp_file_new_for_config_path (proof->profile, NULL);
|
|
||||||
|
|
||||||
gimp_color_profile_combo_box_set_active_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
|
|
||||||
file, NULL);
|
|
||||||
|
|
||||||
if (file)
|
|
||||||
g_object_unref (file);
|
|
||||||
}
|
|
||||||
|
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
|
||||||
_("_Profile:"), 0.0, 0.5,
|
|
||||||
combo, 1, FALSE);
|
|
||||||
|
|
||||||
combo = gimp_prop_enum_combo_box_new (G_OBJECT (proof), "intent", 0, 0);
|
|
||||||
|
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
|
||||||
_("_Intent:"), 0.0, 0.5,
|
|
||||||
combo, 1, FALSE);
|
|
||||||
|
|
||||||
toggle = gimp_prop_check_button_new (G_OBJECT (proof),
|
|
||||||
"black-point-compensation",
|
|
||||||
_("_Black Point Compensation"));
|
|
||||||
gtk_table_attach_defaults (GTK_TABLE (table), toggle, 1, 2, 2, 3);
|
|
||||||
gtk_widget_show (toggle);
|
|
||||||
|
|
||||||
return table;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cdisplay_proof_changed (GimpColorDisplay *display)
|
|
||||||
{
|
|
||||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
|
||||||
GimpColorProfile *proof_profile = NULL;
|
|
||||||
GimpColorProfile *rgb_profile;
|
|
||||||
GFile *file;
|
|
||||||
|
|
||||||
if (proof->transform)
|
|
||||||
{
|
|
||||||
g_object_unref (proof->transform);
|
|
||||||
proof->transform = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! proof->profile)
|
|
||||||
return;
|
|
||||||
|
|
||||||
rgb_profile = gimp_color_profile_new_rgb_srgb ();
|
|
||||||
|
|
||||||
file = gimp_file_new_for_config_path (proof->profile, NULL);
|
|
||||||
|
|
||||||
if (file)
|
|
||||||
{
|
|
||||||
proof_profile = gimp_color_profile_new_from_file (file, NULL);
|
|
||||||
g_object_unref (file);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (proof_profile)
|
|
||||||
{
|
|
||||||
GimpColorTransformFlags flags = 0;
|
|
||||||
|
|
||||||
if (proof->bpc)
|
|
||||||
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
|
|
||||||
|
|
||||||
proof->transform =
|
|
||||||
gimp_color_transform_new_proofing (rgb_profile,
|
|
||||||
babl_format ("R'G'B'A float"),
|
|
||||||
rgb_profile,
|
|
||||||
babl_format ("R'G'B'A float"),
|
|
||||||
proof_profile,
|
|
||||||
proof->intent,
|
|
||||||
proof->intent,
|
|
||||||
flags);
|
|
||||||
|
|
||||||
g_object_unref (proof_profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (rgb_profile);
|
|
||||||
}
|
|
@ -76,5 +76,3 @@ modules/controller-midi.c
|
|||||||
modules/display-filter-color-blind.c
|
modules/display-filter-color-blind.c
|
||||||
modules/display-filter-gamma.c
|
modules/display-filter-gamma.c
|
||||||
modules/display-filter-high-contrast.c
|
modules/display-filter-high-contrast.c
|
||||||
modules/display-filter-lcms.c
|
|
||||||
modules/display-filter-proof.c
|
|
||||||
|
Reference in New Issue
Block a user