added GIMP_TYPE_COLOR_ARRAY and GIMP_TYPE_PARAM_COLOR_ARRAY in preparation

2008-07-12  Sven Neumann  <sven@gimp.org>

	* app/core/gimpparamspecs.[ch]: added GIMP_TYPE_COLOR_ARRAY and
	GIMP_TYPE_PARAM_COLOR_ARRAY in preparation for fixing bug 
#332206.


svn path=/trunk/; revision=26150
This commit is contained in:
Sven Neumann 2008-07-12 08:20:14 +00:00 committed by Sven Neumann
parent fd98934856
commit 0fc3b637ea
3 changed files with 175 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2008-07-12 Sven Neumann <sven@gimp.org>
* app/core/gimpparamspecs.[ch]: added GIMP_TYPE_COLOR_ARRAY and
GIMP_TYPE_PARAM_COLOR_ARRAY in preparation for fixing bug #332206.
2008-07-12 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scale.c

View File

@ -2805,3 +2805,128 @@ gimp_value_take_stringarray (GValue *value,
g_value_take_boxed (value, array);
}
/*
* GIMP_TYPE_COLOR_ARRAY
*/
GType
gimp_color_array_get_type (void)
{
static GType type = 0;
if (! type)
type = g_boxed_type_register_static ("GimpColorArray",
(GBoxedCopyFunc) gimp_array_copy,
(GBoxedFreeFunc) gimp_array_free);
return type;
}
/*
* GIMP_TYPE_PARAM_COLOR_ARRAY
*/
static void gimp_param_color_array_class_init (GParamSpecClass *klass);
static void gimp_param_color_array_init (GParamSpec *pspec);
GType
gimp_param_color_array_get_type (void)
{
static GType type = 0;
if (! type)
{
const GTypeInfo info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_color_array_class_init,
NULL, NULL,
sizeof (GimpParamSpecArray),
0,
(GInstanceInitFunc) gimp_param_color_array_init
};
type = g_type_register_static (G_TYPE_PARAM_BOXED,
"GimpParamColorArray", &info, 0);
}
return type;
}
static void
gimp_param_color_array_class_init (GParamSpecClass *klass)
{
klass->value_type = GIMP_TYPE_COLOR_ARRAY;
}
static void
gimp_param_color_array_init (GParamSpec *pspec)
{
}
GParamSpec *
gimp_param_spec_color_array (const gchar *name,
const gchar *nick,
const gchar *blurb,
GParamFlags flags)
{
GimpParamSpecColorArray *array_spec;
array_spec = g_param_spec_internal (GIMP_TYPE_PARAM_COLOR_ARRAY,
name, nick, blurb, flags);
return G_PARAM_SPEC (array_spec);
}
const GimpRGB *
gimp_value_get_colorarray (const GValue *value)
{
g_return_val_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value), NULL);
return (const GimpRGB *) gimp_value_get_array (value);
}
GimpRGB *
gimp_value_dup_colorarray (const GValue *value)
{
g_return_val_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value), NULL);
return (GimpRGB *) gimp_value_dup_array (value);
}
void
gimp_value_set_colorarray (GValue *value,
const GimpRGB *data,
gsize length)
{
g_return_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value));
gimp_value_set_array (value, (const guint8 *) data,
length * sizeof (GimpRGB));
}
void
gimp_value_set_static_colorarray (GValue *value,
const GimpRGB *data,
gsize length)
{
g_return_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value));
gimp_value_set_static_array (value, (const guint8 *) data,
length * sizeof (GimpRGB));
}
void
gimp_value_take_colorarray (GValue *value,
GimpRGB *data,
gsize length)
{
g_return_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value));
gimp_value_take_array (value, (guint8 *) data,
length * sizeof (GimpRGB));
}

View File

@ -859,4 +859,49 @@ void gimp_value_take_stringarray (GValue *value,
gsize length);
/*
* GIMP_TYPE_COLOR_ARRAY
*/
#define GIMP_TYPE_COLOR_ARRAY (gimp_color_array_get_type ())
#define GIMP_VALUE_HOLDS_COLOR_ARRAY(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_COLOR_ARRAY))
GType gimp_color_array_get_type (void) G_GNUC_CONST;
/*
* GIMP_TYPE_PARAM_COLOR_ARRAY
*/
#define GIMP_TYPE_PARAM_COLOR_ARRAY (gimp_param_color_array_get_type ())
#define GIMP_PARAM_SPEC_COLOR_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_COLOR_ARRAY, GimpParamSpecColorArray))
#define GIMP_IS_PARAM_SPEC_COLOR_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_COLOR_ARRAY))
typedef struct _GimpParamSpecColorArray GimpParamSpecColorArray;
struct _GimpParamSpecColorArray
{
GParamSpecBoxed parent_instance;
};
GType gimp_param_color_array_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_color_array (const gchar *name,
const gchar *nick,
const gchar *blurb,
GParamFlags flags);
const GimpRGB * gimp_value_get_colorarray (const GValue *value);
GimpRGB * gimp_value_dup_colorarray (const GValue *value);
void gimp_value_set_colorarray (GValue *value,
const GimpRGB *array,
gsize length);
void gimp_value_set_static_colorarray (GValue *value,
const GimpRGB *array,
gsize length);
void gimp_value_take_colorarray (GValue *value,
GimpRGB *array,
gsize length);
#endif /* __GIMP_PARAM_SPECS_H__ */