app, libgimp*, modules, pdb, plug-ins: new GimpParamColor.

This is meant to obsolete GeglParamColor with at least an additional argument
has_alpha which we need in GIMP. It allows to advertize when a parameter wants
an opaque color, which in particular means we know when displaying a GUI to pick
colors with alpha or not.
This commit is contained in:
Jehan 2024-04-19 23:02:29 +02:00
parent cbb333c220
commit 2b27feb2fd
50 changed files with 526 additions and 162 deletions

View File

@ -446,14 +446,11 @@ dump_describe_param (GParamSpec *param_spec)
param_spec->name);
}
if (GEGL_IS_PARAM_SPEC_COLOR (param_spec))
if (GIMP_IS_PARAM_SPEC_COLOR (param_spec))
{
/* TODO: implement has_alpha parameter to color parameters. */
#if 0
if (gimp_param_spec_color_has_alpha (param_spec))
values = "The color is specified as opaque GeglColor (any Alpha channel is ignored).";
else
#endif
values = "The color is specified as GeglColor.";
}
else if (GIMP_IS_PARAM_SPEC_MEMSIZE (param_spec))

View File

@ -710,7 +710,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
"quick-mask-color",
"Quick mask color",
QUICK_MASK_COLOR_BLURB,
red,
TRUE, red,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_IMPORT_PROMOTE_FLOAT,

View File

@ -422,7 +422,7 @@ gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
"channel-new-color",
"Default new channel color and opacity",
CHANNEL_NEW_COLOR_BLURB,
half_transparent,
TRUE, half_transparent,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_STRING (object_class, PROP_VECTORS_NEW_NAME,

View File

@ -142,7 +142,7 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
"transparency-custom-color1",
_("Transparency custom color 1"),
TRANSPARENCY_CUSTOM_COLOR1_BLURB,
color,
FALSE, color,
GIMP_PARAM_STATIC_STRINGS);
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), GIMP_CHECKS_CUSTOM_COLOR2);
@ -150,7 +150,7 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
"transparency-custom-color2",
_("Transparency custom color 2"),
TRANSPARENCY_CUSTOM_COLOR2_BLURB,
color,
FALSE, color,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_INT (object_class, PROP_SNAP_DISTANCE,
@ -381,7 +381,7 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
GIMP_CONFIG_PROP_COLOR (object_class, PROP_XOR_COLOR,
"xor-color",
NULL, NULL,
color,
FALSE, color,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_IGNORE);

View File

@ -234,7 +234,7 @@ gimp_display_options_class_init (GimpDisplayOptionsClass *klass)
"padding-color",
"Padding color",
CANVAS_PADDING_COLOR_BLURB,
white,
FALSE, white,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_PADDING_IN_SHOW_ALL,
@ -381,7 +381,7 @@ gimp_display_options_fullscreen_class_init (GimpDisplayOptionsFullscreenClass *k
"padding-color",
"Padding color",
CANVAS_PADDING_COLOR_BLURB,
black,
FALSE, black,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_PADDING_IN_SHOW_ALL,

View File

@ -667,14 +667,14 @@ gimp_context_class_init (GimpContextClass *klass)
gimp_context_prop_names[GIMP_CONTEXT_PROP_FOREGROUND],
_("Foreground"),
_("Foreground color"),
black,
FALSE, black,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_COLOR (object_class, GIMP_CONTEXT_PROP_BACKGROUND,
gimp_context_prop_names[GIMP_CONTEXT_PROP_BACKGROUND],
_("Background"),
_("Background color"),
white,
FALSE, white,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_DOUBLE (object_class, GIMP_CONTEXT_PROP_OPACITY,

View File

@ -94,7 +94,7 @@ gimp_grid_class_init (GimpGridClass *klass)
"fgcolor",
_("Foreground color"),
_("The foreground color of the grid."),
/*TRUE,*/ black,
TRUE, black,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_COLOR (object_class, PROP_BGCOLOR,
@ -102,7 +102,7 @@ gimp_grid_class_init (GimpGridClass *klass)
_("Background color"),
_("The background color of the grid; "
"only used in double dashed line style."),
/*TRUE,*/ white,
TRUE, white,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_XSPACING,

View File

@ -231,15 +231,12 @@ prefs_color_button_add (GObject *config,
{
GtkWidget *button;
GParamSpec *pspec;
gboolean has_alpha = TRUE;
gboolean has_alpha;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
property_name);
/* TODO: GimpRGB parameter specs had an "alpha" argument, unlike GeglColor
* space. We need to add back such an argument.
*/
/*has_alpha = gimp_param_spec_rgb_has_alpha (pspec);*/
has_alpha = gimp_param_spec_color_has_alpha (pspec);
button = gimp_prop_color_button_new (config, property_name,
title,

View File

@ -93,8 +93,8 @@ gimp_canvas_pen_class_init (GimpCanvasPenClass *klass)
item_class->stroke = gimp_canvas_pen_stroke;
g_object_class_install_property (object_class, PROP_COLOR,
gegl_param_spec_color_from_string ("color", NULL, NULL,
/*FALSE,*/ "black",
gimp_param_spec_color_from_string ("color", NULL, NULL,
FALSE, "black",
GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_WIDTH,

View File

@ -116,10 +116,10 @@ gimp_operation_colorize_class_init (GimpOperationColorizeClass *klass)
gegl_color_set_pixel (color, babl_format ("HSL float"), hsl);
g_object_class_install_property (object_class, PROP_COLOR,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
_("Color"),
_("Color"),
/*FALSE,*/ color,
FALSE, color,
G_PARAM_READWRITE));
g_object_unref (color);
}

View File

@ -73,7 +73,6 @@ gimp_operation_semi_flatten_class_init (GimpOperationSemiFlattenClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
GeglColor *color;
object_class->set_property = gimp_operation_semi_flatten_set_property;
object_class->get_property = gimp_operation_semi_flatten_get_property;
@ -88,15 +87,13 @@ gimp_operation_semi_flatten_class_init (GimpOperationSemiFlattenClass *klass)
point_class->process = gimp_operation_semi_flatten_process;
color = gegl_color_new ("white");
g_object_class_install_property (object_class, PROP_COLOR,
gegl_param_spec_color ("color",
_("Color"),
_("The color"),
/*FALSE,*/ color,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
gimp_param_spec_color_from_string ("color",
_("Color"),
_("The color"),
FALSE, "white",
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
static void

View File

@ -422,9 +422,10 @@ register_channel_procs (GimpPDB *pdb)
0, 100, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The channel compositing color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
@ -695,9 +696,10 @@ register_channel_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The channel compositing color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -724,9 +726,10 @@ register_channel_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The new channel compositing color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);

View File

@ -3258,9 +3258,10 @@ register_context_procs (GimpPDB *pdb)
"Michael Natterer & Sven Neumann",
"2004");
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("foreground",
gimp_param_spec_color ("foreground",
"foreground",
"The foreground color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -3281,9 +3282,10 @@ register_context_procs (GimpPDB *pdb)
"Michael Natterer & Sven Neumann",
"2004");
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("foreground",
gimp_param_spec_color ("foreground",
"foreground",
"The foreground color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -3304,9 +3306,10 @@ register_context_procs (GimpPDB *pdb)
"Michael Natterer & Sven Neumann",
"2004");
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("background",
gimp_param_spec_color ("background",
"background",
"The background color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -3327,9 +3330,10 @@ register_context_procs (GimpPDB *pdb)
"Michael Natterer & Sven Neumann",
"2004");
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("background",
gimp_param_spec_color ("background",
"background",
"The background color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);

View File

@ -1094,9 +1094,10 @@ register_drawable_procs (GimpPDB *pdb)
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The pixel color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -1135,9 +1136,10 @@ register_drawable_procs (GimpPDB *pdb)
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The pixel color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);

View File

@ -1472,9 +1472,10 @@ register_gradient_procs (GimpPDB *pdb)
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The return color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -1508,9 +1509,10 @@ register_gradient_procs (GimpPDB *pdb)
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The color to set",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -1544,9 +1546,10 @@ register_gradient_procs (GimpPDB *pdb)
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The return color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -1580,9 +1583,10 @@ register_gradient_procs (GimpPDB *pdb)
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The color to set",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);

View File

@ -3574,9 +3574,10 @@ register_image_procs (GimpPDB *pdb)
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The return color",
TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);

View File

@ -549,9 +549,10 @@ register_image_grid_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("fgcolor",
gimp_param_spec_color ("fgcolor",
"fgcolor",
"The image's grid foreground color",
TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -578,9 +579,10 @@ register_image_grid_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("fgcolor",
gimp_param_spec_color ("fgcolor",
"fgcolor",
"The new foreground color",
TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -607,9 +609,10 @@ register_image_grid_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("bgcolor",
gimp_param_spec_color ("bgcolor",
"bgcolor",
"The image's grid background color",
TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -636,9 +639,10 @@ register_image_grid_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("bgcolor",
gimp_param_spec_color ("bgcolor",
"bgcolor",
"The new background color",
TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);

View File

@ -398,9 +398,10 @@ register_image_select_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The color to select",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);

View File

@ -662,9 +662,10 @@ register_palette_procs (GimpPDB *pdb)
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The color for the added entry.",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
@ -733,9 +734,10 @@ register_palette_procs (GimpPDB *pdb)
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The color at the index.",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -768,9 +770,10 @@ register_palette_procs (GimpPDB *pdb)
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The new color",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);

View File

@ -5621,9 +5621,10 @@ register_plug_in_compat_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"Color to remove",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -7665,9 +7666,10 @@ register_plug_in_compat_procs (GimpPDB *pdb)
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"Color of supernova",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
@ -7875,9 +7877,10 @@ register_plug_in_compat_procs (GimpPDB *pdb)
0, 5, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("background-color",
gimp_param_spec_color ("background-color",
"background color",
"Background color (for background-type == 5)",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
@ -8848,15 +8851,17 @@ register_plug_in_compat_procs (GimpPDB *pdb)
0, 2, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("col1",
gimp_param_spec_color ("col1",
"col1",
"fist color (sometimes unused)",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("col2",
gimp_param_spec_color ("col2",
"col2",
"second color (sometimes unused)",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,

View File

@ -1682,9 +1682,10 @@ register_text_layer_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The color of the text.",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
@ -1711,9 +1712,10 @@ register_text_layer_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"color",
"The color to use for the text",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);

View File

@ -362,13 +362,12 @@ gimp_prop_widget_new_from_pspec (GObject *config,
gimp_prop_gui_bind_label (widget, widget);
}
else if (GEGL_IS_PARAM_SPEC_COLOR (pspec))
else if (GIMP_IS_PARAM_SPEC_COLOR (pspec))
{
gboolean has_alpha = TRUE;
gboolean has_alpha;
GtkWidget *button;
/* TODO: need an alpha argument to GeglParamSpecColor. */
/*has_alpha = gimp_param_spec_rgb_has_alpha (pspec);*/
has_alpha = gimp_param_spec_color_has_alpha (pspec);
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);

View File

@ -236,7 +236,7 @@ gimp_text_class_init (GimpTextClass *klass)
GIMP_CONFIG_PROP_COLOR (object_class, PROP_COLOR,
"color",
NULL, NULL,
black,
FALSE, black,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_OUTLINE,
@ -341,7 +341,7 @@ gimp_text_class_init (GimpTextClass *klass)
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_COLOR (object_class, PROP_OUTLINE_FOREGROUND,
"outline-foreground", NULL, NULL,
gray,
FALSE, gray,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_OUTLINE_WIDTH,
"outline-width", NULL, NULL,

View File

@ -115,7 +115,7 @@ gimp_foreground_select_options_class_init (GimpForegroundSelectOptionsClass *kla
"mask-color",
_("Preview color"),
_("Color of selection preview mask"),
blue,
TRUE, blue,
GIMP_PARAM_STATIC_STRINGS);
g_object_unref (blue);

View File

@ -288,7 +288,7 @@ gimp_text_options_class_init (GimpTextOptionsClass *klass)
GIMP_CONFIG_PROP_COLOR (object_class, PROP_OUTLINE_FOREGROUND,
"outline-foreground",
NULL, NULL,
gray,
FALSE, gray,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_OBJECT (object_class, PROP_OUTLINE_PATTERN,
"outline-pattern",

View File

@ -181,9 +181,9 @@ gimp_action_default_init (GimpActionInterface *iface)
G_PARAM_EXPLICIT_NOTIFY));
g_object_interface_install_property (iface,
gegl_param_spec_color_from_string ("color",
gimp_param_spec_color_from_string ("color",
NULL, NULL,
"black",
TRUE, "black",
GIMP_PARAM_READWRITE));
g_object_interface_install_property (iface,
g_param_spec_object ("viewable",

View File

@ -83,9 +83,9 @@ gimp_color_bar_class_init (GimpColorBarClass *klass)
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_COLOR,
gegl_param_spec_color_from_string ("color",
gimp_param_spec_color_from_string ("color",
NULL, NULL,
/*FALSE,*/ "white",
FALSE, "white",
GIMP_PARAM_WRITABLE |
G_PARAM_CONSTRUCT));

View File

@ -201,9 +201,9 @@ gimp_menu_model_class_init (GimpMenuModelClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_EXPLICIT_NOTIFY));
g_object_class_install_property (object_class, PROP_COLOR,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
NULL, NULL,
/*TRUE,*/ NULL,
TRUE, NULL,
GIMP_PARAM_READWRITE |
G_PARAM_EXPLICIT_NOTIFY));
}

View File

@ -235,9 +235,9 @@ gimp_meter_class_init (GimpMeterClass *klass)
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_LED_COLOR,
gegl_param_spec_color_from_string ("led-color",
gimp_param_spec_color_from_string ("led-color",
NULL, NULL,
/*TRUE,*/ "red",
TRUE, "red",
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}

View File

@ -374,7 +374,7 @@ gimp_prop_color_button_new (GObject *config,
GeglColor *color = NULL;
param_spec = check_param_spec_w (config, property_name,
GEGL_TYPE_PARAM_COLOR, G_STRFUNC);
GIMP_TYPE_PARAM_COLOR, G_STRFUNC);
if (! param_spec)
return NULL;

View File

@ -152,7 +152,8 @@ _gimp_gp_param_def_to_param_spec (const GPParamDef *param_def)
break;
case GP_PARAM_DEF_TYPE_GEGL_COLOR:
if (! strcmp (param_def->type_name, "GeglParamColor"))
if (! strcmp (param_def->type_name, "GeglParamColor") ||
! strcmp (param_def->type_name, "GimpParamColor"))
{
GeglColor *default_color = NULL;
@ -200,7 +201,9 @@ _gimp_gp_param_def_to_param_spec (const GPParamDef *param_def)
gegl_color_set_pixel (default_color, format, default_val->data);
}
return gegl_param_spec_color (name, nick, blurb, default_color, flags);
return gimp_param_spec_color (name, nick, blurb,
param_def->meta.m_gegl_color.has_alpha,
default_color, flags);
}
break;
@ -397,19 +400,24 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
param_def->meta.m_string.default_val = gsspec->default_value;
}
else if (GEGL_IS_PARAM_SPEC_COLOR (pspec) ||
GIMP_IS_PARAM_SPEC_COLOR (pspec) ||
(pspec_type == G_TYPE_PARAM_OBJECT && value_type == GEGL_TYPE_COLOR))
{
GPParamColor *default_val = NULL;
GeglColor *default_color;
param_def->param_def_type = GP_PARAM_DEF_TYPE_GEGL_COLOR;
/* TODO: no no-alpha support for the time being. */
/*param_def->meta.m_gegl_color.has_alpha = TRUE;*/
param_def->meta.m_gegl_color.has_alpha = TRUE;
if (GEGL_IS_PARAM_SPEC_COLOR (pspec))
{
default_color = gegl_param_spec_color_get_default (pspec);
}
else if (GIMP_IS_PARAM_SPEC_COLOR (pspec))
{
default_color = gimp_param_spec_color_get_default (pspec);
param_def->meta.m_gegl_color.has_alpha = gimp_param_spec_color_has_alpha (pspec);
}
else
{
const GValue *value = g_param_spec_get_default_value (pspec);
@ -417,6 +425,7 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
default_color = g_value_get_object (value);
param_def->type_name = "GeglParamColor";
}
if (default_color != NULL)
{
const Babl *format;

View File

@ -296,20 +296,38 @@ G_BEGIN_DECLS
*/
#define GIMP_PROC_ARG_COLOR(procedure, name, nick, blurb, has_alpha, default, flags) \
gimp_procedure_add_argument (procedure,\
gegl_param_spec_color (name, nick, blurb,\
default, \
gimp_param_spec_color (name, nick, blurb,\
has_alpha, default, \
flags))
#define GIMP_PROC_AUX_ARG_COLOR(procedure, name, nick, blurb, has_alpha, default, flags) \
gimp_procedure_add_aux_argument (procedure,\
gegl_param_spec_color (name, nick, blurb,\
default, \
gimp_param_spec_color (name, nick, blurb,\
has_alpha, default, \
flags))
#define GIMP_PROC_VAL_COLOR(procedure, name, nick, blurb, has_alpha, default, flags) \
gimp_procedure_add_return_value (procedure,\
gegl_param_spec_color (name, nick, blurb,\
default, \
gimp_param_spec_color (name, nick, blurb,\
has_alpha, default, \
flags))
#define GIMP_PROC_ARG_COLOR_FROM_STRING(procedure, name, nick, blurb, has_alpha, default, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_color_from_string (name, nick, blurb,\
has_alpha, default, \
flags))
#define GIMP_PROC_AUX_ARG_COLOR_FROM_STRING(procedure, name, nick, blurb, has_alpha, default, flags) \
gimp_procedure_add_aux_argument (procedure,\
gimp_param_spec_color_from_string (name, nick, blurb,\
has_alpha, default, \
flags))
#define GIMP_PROC_VAL_COLOR_FROM_STRING(procedure, name, nick, blurb, has_alpha, default, flags) \
gimp_procedure_add_return_value (procedure,\
gimp_param_spec_color_from_string (name, nick, blurb,\
has_alpha, default, \
flags))
#define GIMP_VALUES_GET_COLOR(args, n, value) \

View File

@ -740,7 +740,8 @@ gimp_procedure_dialog_get_widget (GimpProcedureDialog *dialog,
property, -1);
}
}
else if (G_PARAM_SPEC_TYPE (pspec) == GEGL_TYPE_PARAM_COLOR)
else if (G_PARAM_SPEC_TYPE (pspec) == GIMP_TYPE_PARAM_COLOR ||
G_PARAM_SPEC_TYPE (pspec) == GEGL_TYPE_PARAM_COLOR)
{
if (widget_type == G_TYPE_NONE || widget_type == GIMP_TYPE_LABEL_COLOR)
{
@ -928,7 +929,8 @@ gimp_procedure_dialog_get_color_widget (GimpProcedureDialog *dialog,
return NULL;
}
if (G_PARAM_SPEC_TYPE (pspec) == GEGL_TYPE_PARAM_COLOR)
if (G_PARAM_SPEC_TYPE (pspec) == GIMP_TYPE_PARAM_COLOR ||
G_PARAM_SPEC_TYPE (pspec) == GEGL_TYPE_PARAM_COLOR)
{
widget = gimp_prop_label_color_new (G_OBJECT (dialog->priv->config),
property, editable);

View File

@ -41,11 +41,26 @@
**/
static void gimp_param_color_class_init (GParamSpecClass *klass);
static void gimp_param_color_init (GParamSpec *pspec);
static void gimp_param_color_finalize (GParamSpec *pspec);
static gboolean gimp_param_color_validate (GParamSpec *pspec,
GValue *value);
static void gimp_param_color_set_default (GParamSpec *pspec,
GValue *value);
static gint gimp_param_color_cmp (GParamSpec *param_spec,
const GValue *value1,
const GValue *value2);
static const Babl * gimp_babl_format_get_with_alpha (const Babl *format);
static gfloat gimp_color_get_CIE2000_distance (GeglColor *color1,
GeglColor *color2);
/*
* GEGL_TYPE_COLOR
*/
/**
* gimp_color_set_alpha:
* @color: a [class@Gegl.Color]
@ -319,6 +334,255 @@ gimp_color_is_out_of_gamut (GeglColor *color,
}
/*
* GIMP_TYPE_PARAM_COLOR
*/
struct _GimpParamSpecColor
{
GParamSpecObject parent_instance;
GeglColor *default_color;
gboolean has_alpha;
/* TODO: these 2 settings are not currently settable:
* - none_ok: whether a parameter were to allow NULL as a value. Of course, it
* should imply that default_color must be set.
* - validate: legacy GimpRGB code was implying checking if the RGB values
* were out of [0; 1], i.e. that new code should check if the
* color is out of self-gamut (bounded value).
* We could also add a check for invalid values regardless of
* gamut (though maybe this validation should happen regardless
* and the settings should just be oog_validate).
* These can be implemented later as independent functions, especially as the
* GimpParamSpecColor struct is private.
*/
gboolean none_ok;
gboolean validate;
};
GType
gimp_param_color_get_type (void)
{
static GType type = 0;
if (G_UNLIKELY (type == 0))
{
const GTypeInfo info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_color_class_init,
NULL, NULL,
sizeof (GimpParamSpecColor),
0,
(GInstanceInitFunc) gimp_param_color_init
};
type = g_type_register_static (G_TYPE_PARAM_OBJECT, "GimpParamColor", &info, 0);
}
return type;
}
static void
gimp_param_color_class_init (GParamSpecClass *klass)
{
klass->finalize = gimp_param_color_finalize;
klass->value_type = GEGL_TYPE_COLOR;
klass->value_validate = gimp_param_color_validate;
klass->value_set_default = gimp_param_color_set_default;
klass->values_cmp = gimp_param_color_cmp;
}
static void
gimp_param_color_init (GParamSpec *pspec)
{
GimpParamSpecColor *cspec = GIMP_PARAM_SPEC_COLOR (pspec);
cspec->default_color = NULL;
cspec->has_alpha = TRUE;
cspec->none_ok = TRUE;
cspec->validate = FALSE;
}
static void
gimp_param_color_finalize (GParamSpec *pspec)
{
GimpParamSpecColor *cspec = GIMP_PARAM_SPEC_COLOR (pspec);
GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (GIMP_TYPE_PARAM_COLOR));
g_clear_object (&cspec->default_color);
parent_class->finalize (pspec);
}
static gboolean
gimp_param_color_validate (GParamSpec *pspec,
GValue *value)
{
GimpParamSpecColor *cspec = GIMP_PARAM_SPEC_COLOR (pspec);
GeglColor *color = value->data[0].v_pointer;
if (! cspec->none_ok && color == NULL)
return TRUE;
if (color && ! GEGL_IS_COLOR (color))
{
g_object_unref (color);
value->data[0].v_pointer = NULL;
return TRUE;
}
if (cspec->validate && gimp_color_is_out_of_self_gamut (color))
{
/* TODO: See g_param_value_validate() documentation. The value_validate()
* method must also modify the value to ensure validity. When it's done,
* return TRUE.
*/
return FALSE;
}
return FALSE;
}
static void
gimp_param_color_set_default (GParamSpec *pspec,
GValue *value)
{
GimpParamSpecColor *cspec = GIMP_PARAM_SPEC_COLOR (pspec);
if (cspec->default_color)
g_value_take_object (value, gegl_color_duplicate (cspec->default_color));
}
static gint
gimp_param_color_cmp (GParamSpec *param_spec,
const GValue *value1,
const GValue *value2)
{
GeglColor *color1 = g_value_get_object (value1);
GeglColor *color2 = g_value_get_object (value2);
const Babl *format1;
if (! color1 || ! color2)
return color2 ? -1 : (color1 ? 1 : 0);
format1 = gegl_color_get_format (color1);
if (format1 != gegl_color_get_format (color2))
{
return 1;
}
else
{
guint8 pixel1[48];
guint8 pixel2[48];
gegl_color_get_pixel (color1, format1, pixel1);
gegl_color_get_pixel (color2, format1, pixel2);
return memcmp (pixel1, pixel2, babl_format_get_bytes_per_pixel (format1));
}
}
/**
* gimp_param_spec_color:
* @name: canonical name of the property specified
* @nick: nick name for the property specified
* @blurb: description of the property specified
* @has_alpha: %TRUE if the alpha channel has relevance.
* @default_color: the default value for the property specified
* @flags: flags for the property specified
*
* Creates a new #GParamSpec instance specifying a #GeglColor property.
*
* Returns: (transfer full): a newly created parameter specification
*/
GParamSpec *
gimp_param_spec_color (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean has_alpha,
GeglColor *default_color,
GParamFlags flags)
{
GimpParamSpecColor *cspec;
cspec = g_param_spec_internal (GIMP_TYPE_PARAM_COLOR, name, nick, blurb, flags);
cspec->default_color = default_color;
if (default_color)
g_object_ref (default_color);
cspec->has_alpha = has_alpha;
return G_PARAM_SPEC (cspec);
}
/**
* gimp_param_spec_color_from_string:
* @name: canonical name of the property specified
* @nick: nick name for the property specified
* @blurb: description of the property specified
* @has_alpha: %TRUE if the alpha channel has relevance.
* @default_color_string: the default value for the property specified
* @flags: flags for the property specified
*
* Creates a new #GParamSpec instance specifying a #GeglColor property.
*
* Returns: (transfer full): a newly created parameter specification
*/
GParamSpec *
gimp_param_spec_color_from_string (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean has_alpha,
const gchar *default_color_string,
GParamFlags flags)
{
GimpParamSpecColor *cspec;
cspec = g_param_spec_internal (GIMP_TYPE_PARAM_COLOR,
name, nick, blurb, flags);
cspec->default_color = g_object_new (GEGL_TYPE_COLOR,
"string", default_color_string,
NULL);
cspec->has_alpha = has_alpha;
return G_PARAM_SPEC (cspec);
}
/**
* gimp_param_spec_color_get_default:
* @pspec: a #GeglColor #GParamSpec
*
* Get the default color value of the param spec
*
* Returns: (transfer none): the default #GeglColor
*/
GeglColor *
gimp_param_spec_color_get_default (GParamSpec *pspec)
{
return GIMP_PARAM_SPEC_COLOR (pspec)->default_color;
}
/**
* gimp_param_spec_color_has_alpha:
* @pspec: a #GParamSpec to hold an #GeglColor value.
*
* Returns: %TRUE if the alpha channel is relevant.
*
* Since: 2.4
**/
gboolean
gimp_param_spec_color_has_alpha (GParamSpec *pspec)
{
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_COLOR (pspec), FALSE);
return GIMP_PARAM_SPEC_COLOR (pspec)->has_alpha;
}
/* Private functions. */
static const Babl *

View File

@ -80,6 +80,11 @@ EXPORTS
gimp_hsv_set
gimp_hsv_to_rgb
gimp_hsva_set
gimp_param_color_get_type
gimp_param_spec_color
gimp_param_spec_color_from_string
gimp_param_spec_color_get_default
gimp_param_spec_color_has_alpha
gimp_pixbuf_create_buffer
gimp_pixbuf_get_format
gimp_pixbuf_get_icc_profile

View File

@ -64,6 +64,32 @@ gboolean gimp_color_is_out_of_self_gamut (GeglColor *color);
gboolean gimp_color_is_out_of_gamut (GeglColor *color,
const Babl *space);
/*
* GIMP_TYPE_PARAM_COLOR
*/
#define GIMP_TYPE_PARAM_COLOR (gimp_param_color_get_type ())
#define GIMP_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_COLOR, GimpParamSpecColor))
#define GIMP_IS_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_COLOR))
GType gimp_param_color_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_color (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean has_alpha,
GeglColor *default_color,
GParamFlags flags);
GParamSpec * gimp_param_spec_color_from_string (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean has_alpha,
const gchar *default_color_string,
GParamFlags flags);
GeglColor * gimp_param_spec_color_get_default (GParamSpec *pspec);
gboolean gimp_param_spec_color_has_alpha (GParamSpec *pspec);
G_END_DECLS

View File

@ -33,6 +33,7 @@ typedef struct _GimpColorManaged GimpColorManaged; /* dummy typedef */
typedef struct _GimpColorProfile GimpColorProfile;
typedef struct _GimpColorTransform GimpColorTransform;
typedef struct _GimpParamSpecColor GimpParamSpecColor;
/* usually we don't keep the structure definitions in the types file
* but GimpRGB appears in too many header files...

View File

@ -326,7 +326,7 @@ gimp_color_config_class_init (GimpColorConfigClass *klass)
"out-of-gamut-color",
_("Out of gamut warning color"),
OUT_OF_GAMUT_COLOR_BLURB,
magenta,
FALSE, magenta,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SHOW_RGB_U8,

View File

@ -249,6 +249,21 @@ gimp_config_param_spec_duplicate (GParamSpec *pspec)
spec->default_value,
flags);
}
else if (GIMP_IS_PARAM_SPEC_COLOR (pspec))
{
GeglColor *color;
GValue value = G_VALUE_INIT;
g_value_init (&value, GEGL_TYPE_COLOR);
g_param_value_set_default (pspec, &value);
color = g_value_dup_object (&value);
g_value_unset (&value);
copy = gimp_param_spec_color (name, nick, blurb,
gimp_param_spec_color_has_alpha (pspec),
color, flags);
g_clear_object (&color);
}
else if (GEGL_IS_PARAM_SPEC_COLOR (pspec))
{
GeglColor *color;
@ -260,7 +275,6 @@ gimp_config_param_spec_duplicate (GParamSpec *pspec)
g_value_unset (&value);
copy = gegl_param_spec_color (name, nick, blurb,
/*TRUE,*/
color, flags);
g_clear_object (&color);
}

View File

@ -192,10 +192,10 @@ G_BEGIN_DECLS
G_PARAM_READWRITE |\
GIMP_CONFIG_PARAM_SERIALIZE))
#define GIMP_CONFIG_PROP_COLOR(class, id, name, nick, blurb, default, flags) \
#define GIMP_CONFIG_PROP_COLOR(class, id, name, nick, blurb, has_alpha, default, flags) \
g_object_class_install_property (class, id,\
gegl_param_spec_color (name, nick, blurb,\
default,\
gimp_param_spec_color (name, nick, blurb,\
has_alpha, default,\
flags |\
G_PARAM_READWRITE |\
GIMP_CONFIG_PARAM_SERIALIZE))

View File

@ -297,8 +297,6 @@ gimp_config_serialize_property (GimpConfig *config,
else if (GIMP_VALUE_HOLDS_COLOR (&value))
{
GeglColor *color = g_value_get_object (&value);
/* TODO: serialize has_alpha. */
/*gboolean has_alpha = gimp_param_spec_color_has_alpha (param_spec);*/
gboolean free_color = FALSE;
gimp_config_writer_open (writer, param_spec->name);

View File

@ -110,10 +110,10 @@ gimp_cell_renderer_color_class_init (GimpCellRendererColorClass *klass)
cell_class->render = gimp_cell_renderer_color_render;
g_object_class_install_property (object_class, PROP_COLOR,
gegl_param_spec_color ("color",
gimp_param_spec_color ("color",
"Color",
"The displayed color",
NULL,
TRUE, NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));

View File

@ -181,10 +181,10 @@ gimp_color_area_class_init (GimpColorAreaClass *klass)
* Since: 2.4
*/
g_object_class_install_property (object_class, PROP_COLOR,
gegl_param_spec_color_from_string ("color",
gimp_param_spec_color_from_string ("color",
"Color",
"The displayed color",
"black",
TRUE, "black",
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
/**

View File

@ -237,10 +237,10 @@ gimp_color_button_class_init (GimpColorButtonClass *klass)
* Since: 2.4
*/
g_object_class_install_property (object_class, PROP_COLOR,
gegl_param_spec_color_from_string ("color",
gimp_param_spec_color_from_string ("color",
"Color",
"The color displayed in the button's color area",
"black",
TRUE, "black",
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
/**

View File

@ -113,10 +113,10 @@ gimp_label_color_class_init (GimpLabelColorClass *klass)
*
* Since: 3.0
**/
object_props[PROP_VALUE] = gegl_param_spec_color_from_string ("value",
object_props[PROP_VALUE] = gimp_param_spec_color_from_string ("value",
"Color",
"The displayed color",
"black",
TRUE, "black",
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT);

View File

@ -167,17 +167,17 @@ gimp_preview_area_class_init (GimpPreviewAreaClass *klass)
GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_CHECK_CUSTOM_COLOR1,
gegl_param_spec_color ("check-custom-color1",
gimp_param_spec_color ("check-custom-color1",
_("Custom Checks Color 1"),
"The first color of the checkerboard pattern indicating transparency",
color1_default,
FALSE, color1_default,
GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_CHECK_CUSTOM_COLOR2,
gegl_param_spec_color ("check-custom-color2",
gimp_param_spec_color ("check-custom-color2",
_("Custom Checks Color 2"),
"The second color of the checkerboard pattern indicating transparency",
color2_default,
FALSE, color2_default,
GIMP_PARAM_READWRITE));
g_object_unref (color1_default);

View File

@ -67,6 +67,11 @@ static GParamSpec * check_param_spec_w (GObject *object,
const gchar *property_name,
GType type,
const gchar *strloc);
static GParamSpec * check_param_specs_w (GObject *object,
const gchar *property_name,
GType type1,
GType type2,
const gchar *strloc);
static gboolean get_numeric_values (GObject *object,
GParamSpec *param_spec,
@ -419,35 +424,10 @@ gimp_prop_int_combo_box_new (GObject *config,
g_return_val_if_fail (property_name != NULL, NULL);
/* Require property is integer valued type: INT or ENUM, and is writeable. */
param_spec = check_param_spec_quiet (config, property_name,
G_TYPE_PARAM_INT, G_STRFUNC);
if (param_spec)
{
param_spec = check_param_spec_w (config, property_name,
G_TYPE_PARAM_INT, G_STRFUNC);
if (! param_spec)
return NULL;
}
else
{
param_spec = check_param_spec_quiet (config, property_name,
G_TYPE_PARAM_ENUM, G_STRFUNC);
if (param_spec)
{
param_spec = check_param_spec_w (config, property_name,
G_TYPE_PARAM_ENUM, G_STRFUNC);
if (! param_spec)
return NULL;
}
else
{
g_warning ("%s: property '%s' of %s is not integer valued.",
G_STRFUNC,
param_spec->name,
g_type_name (param_spec->owner_type));
return NULL;
}
}
param_spec = check_param_specs_w (config, property_name, G_TYPE_PARAM_INT,
G_TYPE_PARAM_ENUM, G_STRFUNC);
if (! param_spec)
return NULL;
combo_box = g_object_new (GIMP_TYPE_INT_COMBO_BOX,
"model", store,
@ -4091,8 +4071,8 @@ gimp_prop_color_area_new (GObject *config,
GtkWidget *area;
GeglColor *color = NULL;
param_spec = check_param_spec_w (config, property_name,
GEGL_TYPE_PARAM_COLOR, G_STRFUNC);
param_spec = check_param_specs_w (config, property_name, GEGL_TYPE_PARAM_COLOR,
GIMP_TYPE_PARAM_COLOR, G_STRFUNC);
if (! param_spec)
return NULL;
@ -4199,8 +4179,8 @@ gimp_prop_color_select_new (GObject *config,
GtkWidget *button;
GeglColor *value = NULL;
param_spec = check_param_spec_w (config, property_name,
GEGL_TYPE_PARAM_COLOR, G_STRFUNC);
param_spec = check_param_specs_w (config, property_name, GEGL_TYPE_PARAM_COLOR,
GIMP_TYPE_PARAM_COLOR, G_STRFUNC);
if (! param_spec)
return NULL;
@ -4247,8 +4227,8 @@ gimp_prop_label_color_new (GObject *config,
const gchar *label;
GeglColor *value;
param_spec = check_param_spec_w (config, property_name,
GEGL_TYPE_PARAM_COLOR, G_STRFUNC);
param_spec = check_param_specs_w (config, property_name, GEGL_TYPE_PARAM_COLOR,
GIMP_TYPE_PARAM_COLOR, G_STRFUNC);
if (! param_spec)
return NULL;
@ -4716,6 +4696,44 @@ check_param_spec_w (GObject *object,
return param_spec;
}
static GParamSpec *
check_param_specs_w (GObject *object,
const gchar *property_name,
GType type1,
GType type2,
const gchar *strloc)
{
GParamSpec *param_spec;
param_spec = check_param_spec_quiet (object, property_name, type1, strloc);
if (param_spec)
{
param_spec = check_param_spec_w (object, property_name, type1, strloc);
if (! param_spec)
return NULL;
}
else
{
param_spec = check_param_spec_quiet (object, property_name, type2, strloc);
if (param_spec)
{
param_spec = check_param_spec_w (object, property_name, type2, strloc);
if (! param_spec)
return NULL;
}
}
if (! param_spec)
g_warning ("%s: property '%s' of %s must be of type %s or %s.",
strloc, property_name,
g_type_name (G_TYPE_FROM_INSTANCE (object)),
g_type_name (type1),
g_type_name (type2));
return param_spec;
}
static gboolean
get_numeric_values (GObject *object,
GParamSpec *param_spec,

View File

@ -172,7 +172,7 @@ cdisplay_clip_warning_class_init (CdisplayClipWarningClass *klass)
"shadows-color",
_("Shadows color"),
_("Shadows warning color"),
color,
FALSE, color,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_DEFAULTS);
@ -193,7 +193,7 @@ cdisplay_clip_warning_class_init (CdisplayClipWarningClass *klass)
"highlights-color",
_("Highlights color"),
_("Highlights warning color"),
color,
FALSE, color,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_DEFAULTS);
@ -214,7 +214,7 @@ cdisplay_clip_warning_class_init (CdisplayClipWarningClass *klass)
"bogus-color",
_("Bogus color"),
_("Bogus warning color"),
color,
FALSE, color,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_DEFAULTS);

View File

@ -579,24 +579,14 @@ gimp_param_spec_unit ("$name",
$flags)
CODE
}
elsif ($pdbtype eq 'color') {
elsif ($pdbtype eq 'geglcolor') {
$has_alpha = exists $arg->{has_alpha} ? TRUE : FALSE;
$default = exists $arg->{default} ? $arg->{default} : NULL;
$pspec = <<CODE;
gimp_param_spec_rgb ("$name",
"$nick",
"$blurb",
$has_alpha,
$default,
$flags)
CODE
}
elsif ($pdbtype eq 'geglcolor') {
$default = exists $arg->{default} ? $arg->{default} : NULL;
$pspec = <<CODE;
gegl_param_spec_color ("$name",
gimp_param_spec_color ("$name",
"$nick",
"$blurb",
$has_alpha,
$default,
$flags)
CODE

View File

@ -296,7 +296,7 @@ script_fu_arg_get_param_spec (SFArg *arg,
{
GeglColor *color = sf_color_arg_get_default_color (arg);
pspec = gegl_param_spec_color (name, nick, arg->label, color, G_PARAM_READWRITE);
pspec = gimp_param_spec_color (name, nick, arg->label, TRUE, color, G_PARAM_READWRITE);
g_object_unref (color);
}
break;