libgimpcolor: add gimp_param_spec_rgb_get_default()

This commit is contained in:
Michael Natterer 2019-07-27 16:10:24 +02:00
parent 597f3e0916
commit 3597e92a20
3 changed files with 32 additions and 8 deletions

View File

@ -69,6 +69,7 @@ EXPORTS
gimp_hsva_set
gimp_param_rgb_get_type
gimp_param_spec_rgb
gimp_param_spec_rgb_get_default
gimp_param_spec_rgb_has_alpha
gimp_pixbuf_create_buffer
gimp_pixbuf_get_format

View File

@ -765,10 +765,31 @@ gimp_param_spec_rgb (const gchar *name,
if (default_value)
cspec->default_value = *default_value;
else
gimp_rgba_set (&cspec->default_value, 0.0, 0.0, 0.0, 1.0);
return G_PARAM_SPEC (cspec);
}
/**
* gimp_param_spec_rgb_get_default:
* @pspec: a #GimpParamSpecRGB.
* @default_value: return location for @pspec's default value
*
* Returns the @pspec's default color value.
*
* Since: 2.10.12
**/
void
gimp_param_spec_rgb_get_default (GParamSpec *pspec,
GimpRGB *default_value)
{
g_return_if_fail (GIMP_IS_PARAM_SPEC_RGB (pspec));
g_return_if_fail (default_value != NULL);
*default_value = GIMP_PARAM_SPEC_RGB (pspec)->default_value;
}
/**
* gimp_param_spec_rgb_has_alpha:
* @pspec: a #GParamSpec to hold an #GimpRGB value.

View File

@ -51,16 +51,18 @@ void gimp_value_set_rgb (GValue *value,
#define GIMP_IS_PARAM_SPEC_RGB(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_RGB))
GType gimp_param_rgb_get_type (void) G_GNUC_CONST;
GType gimp_param_rgb_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_rgb (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean has_alpha,
const GimpRGB *default_value,
GParamFlags flags);
GParamSpec * gimp_param_spec_rgb (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean has_alpha,
const GimpRGB *default_value,
GParamFlags flags);
gboolean gimp_param_spec_rgb_has_alpha (GParamSpec *pspec);
void gimp_param_spec_rgb_get_default (GParamSpec *pspec,
GimpRGB *default_value);
gboolean gimp_param_spec_rgb_has_alpha (GParamSpec *pspec);
/* RGB and RGBA color types and operations taken from LibGCK */