Commit 0b9a9e4e authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

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.
parent e779cf0b
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>
* libgimpcolor/gimprgb.[ch]: added "has_alpha" to GimpParamSpecRGB.
......
......@@ -21,8 +21,9 @@
#include "config.h"
#include "stdlib.h"
#include "string.h"
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
......@@ -335,14 +336,14 @@ dump_describe_param (GParamSpec *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 =
"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
values =
"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))
{
......
......@@ -87,6 +87,7 @@ GIMP_RGB_INTENSITY_BLUE
GIMP_TYPE_RGB
GIMP_TYPE_PARAM_RGB
gimp_param_spec_rgb
gimp_param_spec_rgb_has_alpha
GIMP_VALUE_HOLDS_RGB
<SUBSECTION Standard>
GIMP_IS_PARAM_SPEC_RGB
......
......@@ -26,6 +26,7 @@ EXPORTS
gimp_hwb_to_rgb
gimp_param_rgb_get_type
gimp_param_spec_rgb
gimp_param_spec_rgb_has_alpha
gimp_rgb_add
gimp_rgb_clamp
gimp_rgb_composite
......
......@@ -497,6 +497,18 @@ gimp_rgba_distance (const GimpRGB *rgba1,
* 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_init (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);
}
/**
* 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;
}
......@@ -46,17 +46,6 @@ void gimp_value_set_rgb (GValue *value,
#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_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;
......@@ -68,6 +57,8 @@ GParamSpec * gimp_param_spec_rgb (const gchar *name,
const GimpRGB *default_value,
GParamFlags flags);
gboolean gimp_param_spec_rgb_has_alpha (GParamSpec *pspec);
/* 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))
{
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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment