2003-11-19 07:44:35 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2002-10-20 18:14:17 +08:00
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
|
|
|
* gimpcolordisplay.c
|
|
|
|
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2003-11-23 21:28:15 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2002-10-20 18:14:17 +08:00
|
|
|
*
|
2003-11-23 21:28:15 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2002-10-20 18:14:17 +08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2003-11-23 21:28:15 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2002-10-20 18:14:17 +08:00
|
|
|
*
|
2003-11-23 21:28:15 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2002-10-20 18:14:17 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2005-02-06 05:51:47 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2012-05-03 09:36:22 +08:00
|
|
|
#include <gegl.h>
|
2002-10-20 18:14:17 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2005-02-06 05:51:47 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2002-10-20 18:14:17 +08:00
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
2005-02-06 05:16:22 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2002-10-20 18:14:17 +08:00
|
|
|
|
|
|
|
#include "gimpwidgetstypes.h"
|
|
|
|
|
2007-08-07 06:10:09 +08:00
|
|
|
#include "gimpcolordisplay.h"
|
2015-12-13 03:44:46 +08:00
|
|
|
#include "gimpicons.h"
|
2007-08-07 06:10:09 +08:00
|
|
|
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2010-07-06 00:01:28 +08:00
|
|
|
/**
|
|
|
|
* SECTION: gimpcolordisplay
|
|
|
|
* @title: GimpColorDisplay
|
|
|
|
* @short_description: Pluggable GIMP display color correction modules.
|
|
|
|
* @see_also: #GModule, #GTypeModule, #GimpModule
|
|
|
|
*
|
|
|
|
* Functions and definitions for creating pluggable GIMP
|
|
|
|
* display color correction modules.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2003-11-23 21:08:56 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2007-08-07 06:10:09 +08:00
|
|
|
PROP_ENABLED,
|
|
|
|
PROP_COLOR_CONFIG,
|
|
|
|
PROP_COLOR_MANAGED
|
2003-11-23 21:08:56 +08:00
|
|
|
};
|
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CHANGED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2011-01-13 05:03:33 +08:00
|
|
|
|
2011-01-01 02:03:47 +08:00
|
|
|
struct _GimpColorDisplayPrivate
|
2007-08-07 06:10:09 +08:00
|
|
|
{
|
2011-01-01 02:03:47 +08:00
|
|
|
gboolean enabled;
|
2007-08-07 06:10:09 +08:00
|
|
|
GimpColorConfig *config;
|
|
|
|
GimpColorManaged *managed;
|
2011-01-01 02:03:47 +08:00
|
|
|
};
|
|
|
|
|
2018-05-03 18:51:36 +08:00
|
|
|
#define GET_PRIVATE(obj) (((GimpColorDisplay *) (obj))->priv)
|
2007-08-07 06:10:09 +08:00
|
|
|
|
|
|
|
|
2011-01-13 05:03:33 +08:00
|
|
|
|
|
|
|
static void gimp_color_display_constructed (GObject *object);
|
2007-08-08 20:27:11 +08:00
|
|
|
static void gimp_color_display_dispose (GObject *object);
|
2007-08-07 06:10:09 +08:00
|
|
|
static void gimp_color_display_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_color_display_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
|
|
|
static void gimp_color_display_set_color_config (GimpColorDisplay *display,
|
|
|
|
GimpColorConfig *config);
|
|
|
|
static void gimp_color_display_set_color_managed (GimpColorDisplay *display,
|
|
|
|
GimpColorManaged *managed);
|
2002-10-20 18:14:17 +08:00
|
|
|
|
|
|
|
|
2005-12-21 04:35:23 +08:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GimpColorDisplay, gimp_color_display, G_TYPE_OBJECT,
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-19 00:09:39 +08:00
|
|
|
G_ADD_PRIVATE (GimpColorDisplay)
|
2006-05-15 17:46:31 +08:00
|
|
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
|
2002-10-20 18:14:17 +08:00
|
|
|
|
2005-12-21 04:35:23 +08:00
|
|
|
#define parent_class gimp_color_display_parent_class
|
2002-10-23 22:55:07 +08:00
|
|
|
|
2005-12-21 04:35:23 +08:00
|
|
|
static guint display_signals[LAST_SIGNAL] = { 0 };
|
2002-10-20 18:14:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_class_init (GimpColorDisplayClass *klass)
|
|
|
|
{
|
2003-11-23 21:08:56 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
2011-01-13 05:03:33 +08:00
|
|
|
object_class->constructed = gimp_color_display_constructed;
|
2007-08-08 20:27:11 +08:00
|
|
|
object_class->dispose = gimp_color_display_dispose;
|
2003-11-23 21:08:56 +08:00
|
|
|
object_class->set_property = gimp_color_display_set_property;
|
|
|
|
object_class->get_property = gimp_color_display_get_property;
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_ENABLED,
|
2017-06-07 03:19:17 +08:00
|
|
|
g_param_spec_boolean ("enabled",
|
|
|
|
"Enabled",
|
|
|
|
"Whether this display filter is enabled",
|
2003-11-23 21:08:56 +08:00
|
|
|
TRUE,
|
2006-01-31 00:10:56 +08:00
|
|
|
GIMP_PARAM_READWRITE |
|
2003-11-23 21:08:56 +08:00
|
|
|
G_PARAM_CONSTRUCT));
|
2017-06-07 03:19:17 +08:00
|
|
|
|
2007-08-07 06:10:09 +08:00
|
|
|
g_object_class_install_property (object_class, PROP_COLOR_CONFIG,
|
|
|
|
g_param_spec_object ("color-config",
|
2017-06-07 03:19:17 +08:00
|
|
|
"Color Config",
|
|
|
|
"The color config used for this filter",
|
2007-08-07 06:10:09 +08:00
|
|
|
GIMP_TYPE_COLOR_CONFIG,
|
|
|
|
GIMP_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2017-06-07 03:19:17 +08:00
|
|
|
|
2007-08-07 06:10:09 +08:00
|
|
|
g_object_class_install_property (object_class, PROP_COLOR_MANAGED,
|
|
|
|
g_param_spec_object ("color-managed",
|
2017-06-07 03:19:17 +08:00
|
|
|
"Color Managed",
|
|
|
|
"The color managed pixel source that is filtered",
|
2007-08-07 06:10:09 +08:00
|
|
|
GIMP_TYPE_COLOR_MANAGED,
|
|
|
|
GIMP_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2018-04-29 03:16:20 +08:00
|
|
|
|
2002-10-23 22:55:07 +08:00
|
|
|
display_signals[CHANGED] =
|
|
|
|
g_signal_new ("changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpColorDisplayClass, changed),
|
2020-01-12 18:06:05 +08:00
|
|
|
NULL, NULL, NULL,
|
2002-10-23 22:55:07 +08:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2003-11-19 07:44:35 +08:00
|
|
|
klass->name = "Unnamed";
|
|
|
|
klass->help_id = NULL;
|
2017-03-05 23:01:59 +08:00
|
|
|
klass->icon_name = GIMP_ICON_DISPLAY_FILTER;
|
2002-12-19 20:04:39 +08:00
|
|
|
|
2013-11-02 05:34:09 +08:00
|
|
|
klass->convert_buffer = NULL;
|
2002-10-23 22:55:07 +08:00
|
|
|
klass->configure = NULL;
|
2018-04-29 03:16:20 +08:00
|
|
|
|
2002-12-19 20:04:39 +08:00
|
|
|
klass->changed = NULL;
|
2002-10-20 18:14:17 +08:00
|
|
|
}
|
|
|
|
|
2005-12-21 04:35:23 +08:00
|
|
|
static void
|
|
|
|
gimp_color_display_init (GimpColorDisplay *display)
|
|
|
|
{
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-19 00:09:39 +08:00
|
|
|
display->priv = gimp_color_display_get_instance_private (display);
|
2007-08-07 06:10:09 +08:00
|
|
|
}
|
|
|
|
|
2011-01-13 05:03:33 +08:00
|
|
|
static void
|
|
|
|
gimp_color_display_constructed (GObject *object)
|
2007-08-07 06:10:09 +08:00
|
|
|
{
|
2012-11-13 04:51:22 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->constructed (object);
|
2007-08-07 06:10:09 +08:00
|
|
|
|
|
|
|
/* emit an initial "changed" signal after all construct properties are set */
|
|
|
|
gimp_color_display_changed (GIMP_COLOR_DISPLAY (object));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-08-08 20:27:11 +08:00
|
|
|
gimp_color_display_dispose (GObject *object)
|
2007-08-07 06:10:09 +08:00
|
|
|
{
|
2011-01-01 02:03:47 +08:00
|
|
|
GimpColorDisplayPrivate *private = GET_PRIVATE (object);
|
2007-08-07 06:10:09 +08:00
|
|
|
|
|
|
|
if (private->config)
|
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (private->config,
|
|
|
|
gimp_color_display_changed,
|
|
|
|
object);
|
|
|
|
g_object_unref (private->config);
|
|
|
|
private->config = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (private->managed)
|
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (private->managed,
|
|
|
|
gimp_color_display_changed,
|
|
|
|
object);
|
|
|
|
g_object_unref (private->managed);
|
|
|
|
private->managed = NULL;
|
|
|
|
}
|
|
|
|
|
2007-08-08 20:27:11 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
2005-12-21 04:35:23 +08:00
|
|
|
}
|
|
|
|
|
2002-10-20 18:14:17 +08:00
|
|
|
static void
|
2003-11-23 21:08:56 +08:00
|
|
|
gimp_color_display_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2011-01-01 02:03:47 +08:00
|
|
|
GimpColorDisplay *display = GIMP_COLOR_DISPLAY (object);
|
|
|
|
GimpColorDisplayPrivate *private = GET_PRIVATE (object);
|
2003-11-23 21:08:56 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_ENABLED:
|
2011-01-01 02:03:47 +08:00
|
|
|
private->enabled = g_value_get_boolean (value);
|
2003-11-23 21:08:56 +08:00
|
|
|
break;
|
2007-08-07 06:10:09 +08:00
|
|
|
|
|
|
|
case PROP_COLOR_CONFIG:
|
|
|
|
gimp_color_display_set_color_config (display,
|
|
|
|
g_value_get_object (value));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_COLOR_MANAGED:
|
|
|
|
gimp_color_display_set_color_managed (display,
|
|
|
|
g_value_get_object (value));
|
|
|
|
break;
|
|
|
|
|
2003-11-23 21:08:56 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2002-10-20 18:14:17 +08:00
|
|
|
{
|
2011-01-01 02:03:47 +08:00
|
|
|
GimpColorDisplayPrivate *private = GET_PRIVATE (object);
|
2003-11-23 21:08:56 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_ENABLED:
|
2011-01-01 02:03:47 +08:00
|
|
|
g_value_set_boolean (value, private->enabled);
|
2003-11-23 21:08:56 +08:00
|
|
|
break;
|
2007-08-07 06:10:09 +08:00
|
|
|
|
|
|
|
case PROP_COLOR_CONFIG:
|
2011-01-01 02:03:47 +08:00
|
|
|
g_value_set_object (value, private->config);
|
2007-08-07 06:10:09 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_COLOR_MANAGED:
|
2011-01-01 02:03:47 +08:00
|
|
|
g_value_set_object (value, private->managed);
|
2007-08-07 06:10:09 +08:00
|
|
|
break;
|
|
|
|
|
2003-11-23 21:08:56 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2002-10-20 18:14:17 +08:00
|
|
|
}
|
|
|
|
|
2007-08-07 06:10:09 +08:00
|
|
|
static void
|
|
|
|
gimp_color_display_set_color_config (GimpColorDisplay *display,
|
|
|
|
GimpColorConfig *config)
|
|
|
|
{
|
2011-01-01 02:03:47 +08:00
|
|
|
GimpColorDisplayPrivate *private = GET_PRIVATE (display);
|
2007-08-07 06:10:09 +08:00
|
|
|
|
|
|
|
g_return_if_fail (private->config == NULL);
|
|
|
|
|
|
|
|
if (config)
|
|
|
|
{
|
|
|
|
private->config = g_object_ref (config);
|
|
|
|
|
|
|
|
g_signal_connect_swapped (private->config, "notify",
|
|
|
|
G_CALLBACK (gimp_color_display_changed),
|
|
|
|
display);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_set_color_managed (GimpColorDisplay *display,
|
|
|
|
GimpColorManaged *managed)
|
|
|
|
{
|
2011-01-01 02:03:47 +08:00
|
|
|
GimpColorDisplayPrivate *private = GET_PRIVATE (display);
|
2007-08-07 06:10:09 +08:00
|
|
|
|
|
|
|
g_return_if_fail (private->managed == NULL);
|
|
|
|
|
|
|
|
if (managed)
|
|
|
|
{
|
|
|
|
private->managed = g_object_ref (managed);
|
|
|
|
|
|
|
|
g_signal_connect_swapped (private->managed, "profile-changed",
|
|
|
|
G_CALLBACK (gimp_color_display_changed),
|
|
|
|
display);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_clone:
|
|
|
|
* @display: a #GimpColorDisplay
|
|
|
|
*
|
|
|
|
* Creates a copy of @display.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a duplicate of @display.
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2002-10-20 18:14:17 +08:00
|
|
|
GimpColorDisplay *
|
|
|
|
gimp_color_display_clone (GimpColorDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), NULL);
|
|
|
|
|
2005-02-06 05:51:47 +08:00
|
|
|
return GIMP_COLOR_DISPLAY (gimp_config_duplicate (GIMP_CONFIG (display)));
|
2002-10-20 18:14:17 +08:00
|
|
|
}
|
|
|
|
|
2013-11-02 05:34:09 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_convert_buffer:
|
|
|
|
* @display: a #GimpColorDisplay
|
|
|
|
* @buffer: a #GeglBuffer
|
|
|
|
* @area: area in @buffer to convert
|
|
|
|
*
|
|
|
|
* Converts all pixels in @area of @buffer.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.10
|
2013-11-02 05:34:09 +08:00
|
|
|
**/
|
|
|
|
void
|
|
|
|
gimp_color_display_convert_buffer (GimpColorDisplay *display,
|
|
|
|
GeglBuffer *buffer,
|
|
|
|
GeglRectangle *area)
|
|
|
|
{
|
2011-01-01 02:03:47 +08:00
|
|
|
GimpColorDisplayPrivate *private;
|
|
|
|
|
2013-11-02 05:34:09 +08:00
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
|
|
|
g_return_if_fail (GEGL_IS_BUFFER (buffer));
|
|
|
|
|
2011-01-01 02:03:47 +08:00
|
|
|
private = GET_PRIVATE (display);
|
|
|
|
|
|
|
|
if (private->enabled &&
|
2013-11-02 05:34:09 +08:00
|
|
|
GIMP_COLOR_DISPLAY_GET_CLASS (display)->convert_buffer)
|
|
|
|
{
|
|
|
|
GIMP_COLOR_DISPLAY_GET_CLASS (display)->convert_buffer (display, buffer,
|
|
|
|
area);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_load_state:
|
|
|
|
* @display: a #GimpColorDisplay
|
|
|
|
* @state: a #GimpParasite
|
|
|
|
*
|
|
|
|
* Configures @display from the contents of the parasite @state.
|
|
|
|
* @state must be a properly serialized configuration for a
|
|
|
|
* #GimpColorDisplay, such as saved by gimp_color_display_save_state().
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2002-10-20 18:14:17 +08:00
|
|
|
void
|
|
|
|
gimp_color_display_load_state (GimpColorDisplay *display,
|
|
|
|
GimpParasite *state)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
|
|
|
g_return_if_fail (state != NULL);
|
|
|
|
|
2019-09-21 18:21:31 +08:00
|
|
|
gimp_config_deserialize_parasite (GIMP_CONFIG (display),
|
|
|
|
state,
|
|
|
|
NULL, NULL);
|
2002-10-20 18:14:17 +08:00
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_save_state:
|
|
|
|
* @display: a #GimpColorDisplay
|
|
|
|
*
|
|
|
|
* Saves the configuration state of @display as a new parasite.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a #GimpParasite
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2002-10-20 18:14:17 +08:00
|
|
|
GimpParasite *
|
|
|
|
gimp_color_display_save_state (GimpColorDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), NULL);
|
|
|
|
|
2019-09-21 18:21:31 +08:00
|
|
|
return gimp_config_serialize_to_parasite (GIMP_CONFIG (display),
|
|
|
|
"Display/Proof",
|
|
|
|
GIMP_PARASITE_PERSISTENT,
|
|
|
|
NULL);
|
2002-10-20 18:14:17 +08:00
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_configure:
|
|
|
|
* @display: a #GimpColorDisplay
|
|
|
|
*
|
|
|
|
* Creates a configuration widget for @display which can be added to a
|
|
|
|
* container widget.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new configuration widget for @display, or
|
|
|
|
* %NULL if no specific widget exists.
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2002-10-23 22:55:07 +08:00
|
|
|
GtkWidget *
|
|
|
|
gimp_color_display_configure (GimpColorDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), NULL);
|
|
|
|
|
|
|
|
if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->configure)
|
|
|
|
return GIMP_COLOR_DISPLAY_GET_CLASS (display)->configure (display);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-10-20 18:14:17 +08:00
|
|
|
void
|
2002-10-23 22:55:07 +08:00
|
|
|
gimp_color_display_configure_reset (GimpColorDisplay *display)
|
2002-10-20 18:14:17 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
|
|
|
|
2018-04-29 03:16:20 +08:00
|
|
|
gimp_config_reset (GIMP_CONFIG (display));
|
2002-10-20 18:14:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-10-23 22:55:07 +08:00
|
|
|
gimp_color_display_changed (GimpColorDisplay *display)
|
2002-10-20 18:14:17 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (display, display_signals[CHANGED], 0);
|
2002-10-20 18:14:17 +08:00
|
|
|
}
|
2003-11-23 20:08:21 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
gimp_color_display_set_enabled (GimpColorDisplay *display,
|
|
|
|
gboolean enabled)
|
|
|
|
{
|
2011-01-01 02:03:47 +08:00
|
|
|
GimpColorDisplayPrivate *private;
|
|
|
|
|
2003-11-23 20:08:21 +08:00
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
|
|
|
|
2011-01-01 02:03:47 +08:00
|
|
|
private = GET_PRIVATE (display);
|
|
|
|
|
|
|
|
if (enabled != private->enabled)
|
2003-11-23 20:08:21 +08:00
|
|
|
{
|
2003-11-23 21:08:56 +08:00
|
|
|
g_object_set (display,
|
|
|
|
"enabled", enabled,
|
|
|
|
NULL);
|
2003-11-23 20:08:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_color_display_get_enabled (GimpColorDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), FALSE);
|
|
|
|
|
2011-01-01 02:03:47 +08:00
|
|
|
return GET_PRIVATE (display)->enabled;
|
2003-11-23 20:08:21 +08:00
|
|
|
}
|
|
|
|
|
2007-08-07 06:10:09 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_get_config:
|
|
|
|
* @display:
|
|
|
|
*
|
2019-08-03 06:10:14 +08:00
|
|
|
* Returns: (transfer none): a pointer to the #GimpColorConfig
|
2019-08-01 20:02:21 +08:00
|
|
|
* object or %NULL.
|
2007-08-07 06:10:09 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2007-08-07 06:10:09 +08:00
|
|
|
**/
|
|
|
|
GimpColorConfig *
|
|
|
|
gimp_color_display_get_config (GimpColorDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), NULL);
|
|
|
|
|
2011-01-01 02:03:47 +08:00
|
|
|
return GET_PRIVATE (display)->config;
|
2007-08-07 06:10:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_color_display_get_managed:
|
|
|
|
* @display:
|
|
|
|
*
|
2019-08-03 06:10:14 +08:00
|
|
|
* Returns: (transfer none): a pointer to the #GimpColorManaged
|
2019-08-01 20:02:21 +08:00
|
|
|
* object or %NULL.
|
2007-08-07 06:10:09 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2007-08-07 06:10:09 +08:00
|
|
|
**/
|
|
|
|
GimpColorManaged *
|
|
|
|
gimp_color_display_get_managed (GimpColorDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), NULL);
|
|
|
|
|
2011-01-01 02:03:47 +08:00
|
|
|
return GET_PRIVATE (display)->managed;
|
2007-08-07 06:10:09 +08:00
|
|
|
}
|