hide the GimpParamSpecRGB struct again. Added getter for the has_alpha
2006-04-27 Sven Neumann <sven@gimp.org> * libgimpcolor/gimprgb.[ch]: hide the GimpParamSpecRGB struct again. Added getter for the has_alpha field. * libgimpcolor/gimpcolor.def: updated. * app/config/gimpconfig-dump.c * libgimpconfig/gimpconfig-serialize.c: use gimp_param_spec_rgb_has_alpha() instead of accessing the GimpParamSpecRGB struct directly.
This commit is contained in:

committed by
Sven Neumann

parent
e779cf0b0f
commit
0b9a9e4e88
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2006-04-27 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* libgimpcolor/gimprgb.[ch]: hide the GimpParamSpecRGB struct
|
||||||
|
again. Added getter for the has_alpha field.
|
||||||
|
|
||||||
|
* libgimpcolor/gimpcolor.def: updated.
|
||||||
|
|
||||||
|
* app/config/gimpconfig-dump.c
|
||||||
|
* libgimpconfig/gimpconfig-serialize.c: use
|
||||||
|
gimp_param_spec_rgb_has_alpha() instead of accessing the
|
||||||
|
GimpParamSpecRGB struct directly.
|
||||||
|
|
||||||
2006-04-27 Sven Neumann <sven@gimp.org>
|
2006-04-27 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* libgimpcolor/gimprgb.[ch]: added "has_alpha" to GimpParamSpecRGB.
|
* libgimpcolor/gimprgb.[ch]: added "has_alpha" to GimpParamSpecRGB.
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "stdlib.h"
|
#include <stdlib.h>
|
||||||
#include "string.h"
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
@ -335,14 +336,14 @@ dump_describe_param (GParamSpec *param_spec)
|
|||||||
|
|
||||||
if (GIMP_IS_PARAM_SPEC_RGB (param_spec))
|
if (GIMP_IS_PARAM_SPEC_RGB (param_spec))
|
||||||
{
|
{
|
||||||
if (GIMP_PARAM_SPEC_RGB (param_spec)->has_alpha)
|
if (gimp_param_spec_rgb_has_alpha (param_spec))
|
||||||
values =
|
values =
|
||||||
"The color is specified in the form (color-rgba red green blue "
|
"The color is specified in the form (color-rgba red green blue "
|
||||||
"alpha) with channel values as floats between 0.0 and 1.0.";
|
"alpha) with channel values as floats in the range of 0.0 to 1.0.";
|
||||||
else
|
else
|
||||||
values =
|
values =
|
||||||
"The color is specified in the form (color-rgb red green blue) "
|
"The color is specified in the form (color-rgb red green blue) "
|
||||||
"with channel values as floats between 0.0 and 1.0.";
|
"with channel values as floats in the range of 0.0 to 1.0.";
|
||||||
}
|
}
|
||||||
else if (GIMP_IS_PARAM_SPEC_MEMSIZE (param_spec))
|
else if (GIMP_IS_PARAM_SPEC_MEMSIZE (param_spec))
|
||||||
{
|
{
|
||||||
|
@ -87,6 +87,7 @@ GIMP_RGB_INTENSITY_BLUE
|
|||||||
GIMP_TYPE_RGB
|
GIMP_TYPE_RGB
|
||||||
GIMP_TYPE_PARAM_RGB
|
GIMP_TYPE_PARAM_RGB
|
||||||
gimp_param_spec_rgb
|
gimp_param_spec_rgb
|
||||||
|
gimp_param_spec_rgb_has_alpha
|
||||||
GIMP_VALUE_HOLDS_RGB
|
GIMP_VALUE_HOLDS_RGB
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GIMP_IS_PARAM_SPEC_RGB
|
GIMP_IS_PARAM_SPEC_RGB
|
||||||
|
@ -26,6 +26,7 @@ EXPORTS
|
|||||||
gimp_hwb_to_rgb
|
gimp_hwb_to_rgb
|
||||||
gimp_param_rgb_get_type
|
gimp_param_rgb_get_type
|
||||||
gimp_param_spec_rgb
|
gimp_param_spec_rgb
|
||||||
|
gimp_param_spec_rgb_has_alpha
|
||||||
gimp_rgb_add
|
gimp_rgb_add
|
||||||
gimp_rgb_clamp
|
gimp_rgb_clamp
|
||||||
gimp_rgb_composite
|
gimp_rgb_composite
|
||||||
|
@ -497,6 +497,18 @@ gimp_rgba_distance (const GimpRGB *rgba1,
|
|||||||
* GIMP_TYPE_PARAM_RGB
|
* GIMP_TYPE_PARAM_RGB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define GIMP_PARAM_SPEC_RGB(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_RGB, GimpParamSpecRGB))
|
||||||
|
|
||||||
|
typedef struct _GimpParamSpecRGB GimpParamSpecRGB;
|
||||||
|
|
||||||
|
struct _GimpParamSpecRGB
|
||||||
|
{
|
||||||
|
GParamSpecBoxed parent_instance;
|
||||||
|
|
||||||
|
gboolean has_alpha;
|
||||||
|
GimpRGB default_value;
|
||||||
|
};
|
||||||
|
|
||||||
static void gimp_param_rgb_class_init (GParamSpecClass *class);
|
static void gimp_param_rgb_class_init (GParamSpecClass *class);
|
||||||
static void gimp_param_rgb_init (GParamSpec *pspec);
|
static void gimp_param_rgb_init (GParamSpec *pspec);
|
||||||
static void gimp_param_rgb_set_default (GParamSpec *pspec,
|
static void gimp_param_rgb_set_default (GParamSpec *pspec,
|
||||||
@ -676,3 +688,19 @@ gimp_param_spec_rgb (const gchar *name,
|
|||||||
|
|
||||||
return G_PARAM_SPEC (cspec);
|
return G_PARAM_SPEC (cspec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_param_spec_rgb:
|
||||||
|
* @pspec: a #GParamSpec to hold an #GimpRGB value.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the alpha channel is relevant.
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.4
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
gimp_param_spec_rgb_has_alpha (GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_RGB (pspec), FALSE);
|
||||||
|
|
||||||
|
return GIMP_PARAM_SPEC_RGB (pspec)->has_alpha;
|
||||||
|
}
|
||||||
|
@ -29,15 +29,15 @@ G_BEGIN_DECLS
|
|||||||
* GIMP_TYPE_RGB
|
* GIMP_TYPE_RGB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GIMP_TYPE_RGB (gimp_rgb_get_type ())
|
#define GIMP_TYPE_RGB (gimp_rgb_get_type ())
|
||||||
#define GIMP_VALUE_HOLDS_RGB(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_RGB))
|
#define GIMP_VALUE_HOLDS_RGB(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_RGB))
|
||||||
|
|
||||||
GType gimp_rgb_get_type (void) G_GNUC_CONST;
|
GType gimp_rgb_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
void gimp_value_get_rgb (const GValue *value,
|
void gimp_value_get_rgb (const GValue *value,
|
||||||
GimpRGB *rgb);
|
GimpRGB *rgb);
|
||||||
void gimp_value_set_rgb (GValue *value,
|
void gimp_value_set_rgb (GValue *value,
|
||||||
const GimpRGB *rgb);
|
const GimpRGB *rgb);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -46,27 +46,18 @@ void gimp_value_set_rgb (GValue *value,
|
|||||||
|
|
||||||
#define GIMP_TYPE_PARAM_RGB (gimp_param_rgb_get_type ())
|
#define GIMP_TYPE_PARAM_RGB (gimp_param_rgb_get_type ())
|
||||||
#define GIMP_IS_PARAM_SPEC_RGB(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_RGB))
|
#define GIMP_IS_PARAM_SPEC_RGB(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_RGB))
|
||||||
#define GIMP_PARAM_SPEC_RGB(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_RGB, GimpParamSpecRGB))
|
|
||||||
|
|
||||||
typedef struct _GimpParamSpecRGB GimpParamSpecRGB;
|
|
||||||
|
|
||||||
struct _GimpParamSpecRGB
|
|
||||||
{
|
|
||||||
GParamSpecBoxed parent_instance;
|
|
||||||
|
|
||||||
gboolean has_alpha;
|
|
||||||
GimpRGB default_value;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
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,
|
GParamSpec * gimp_param_spec_rgb (const gchar *name,
|
||||||
const gchar *nick,
|
const gchar *nick,
|
||||||
const gchar *blurb,
|
const gchar *blurb,
|
||||||
gboolean has_alpha,
|
gboolean has_alpha,
|
||||||
const GimpRGB *default_value,
|
const GimpRGB *default_value,
|
||||||
GParamFlags flags);
|
GParamFlags flags);
|
||||||
|
|
||||||
|
gboolean gimp_param_spec_rgb_has_alpha (GParamSpec *pspec);
|
||||||
|
|
||||||
|
|
||||||
/* RGB and RGBA color types and operations taken from LibGCK */
|
/* RGB and RGBA color types and operations taken from LibGCK */
|
||||||
|
@ -262,7 +262,7 @@ gimp_config_serialize_property (GimpConfig *config,
|
|||||||
|
|
||||||
if (GIMP_VALUE_HOLDS_RGB (&value))
|
if (GIMP_VALUE_HOLDS_RGB (&value))
|
||||||
{
|
{
|
||||||
gboolean has_alpha = GIMP_PARAM_SPEC_RGB (param_spec)->has_alpha;
|
gboolean has_alpha = gimp_param_spec_rgb_has_alpha (param_spec);
|
||||||
|
|
||||||
success = gimp_config_serialize_rgb (&value, str, has_alpha);
|
success = gimp_config_serialize_rgb (&value, str, has_alpha);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user