mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 01:13:24 +00:00
app, libgimp*, pdb: new "format" type in the PDB.
We have a bunch of special-casing format passing through the PDB, but either we were only passing the encoding, or else we were reconstructing the full format through private intermediate functions. In the space-invasion world, this is not right. Let's have a proper "format" type for PDB which does all the relevant data-passing for us, once and for all! Note that I am creating a wrapper boxed type GimpBablFormat whose only goal is to have recognizable GValue since Babl types don't have GType-s. Moreover I'm not using the GeglParamSpecFormat either, because it just uses pointers which again are a bit annoying in our various PDB code. Having a simple boxed arg is better.
This commit is contained in:
parent
94c7ca6809
commit
aa31d22e9f
9 changed files with 308 additions and 92 deletions
|
@ -753,3 +753,39 @@ gimp_color_get_CIE2000_distance (GeglColor *color1,
|
|||
|
||||
return dE00;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GIMP_TYPE_BABL_FORMAT
|
||||
*/
|
||||
|
||||
static const Babl * gimp_babl_object_copy (const Babl *object);
|
||||
static void gimp_babl_object_free (const Babl *object);
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GimpBablFormat, gimp_babl_format, (GBoxedCopyFunc) gimp_babl_object_copy, (GBoxedFreeFunc) gimp_babl_object_free)
|
||||
|
||||
/**
|
||||
* gimp_babl_object_copy: (skip)
|
||||
* @object: a Babl object.
|
||||
*
|
||||
* Bogus function since [struct@Babl.Object] should just be used as
|
||||
* never-ending pointers.
|
||||
*
|
||||
* Returns: (transfer none): the passed @object.
|
||||
**/
|
||||
const Babl *
|
||||
gimp_babl_object_copy (const Babl *object)
|
||||
{
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_babl_object_free: (skip)
|
||||
* @object: a Babl object.
|
||||
*
|
||||
* Bogus function since [struct@Babl.Object] must not be freed.
|
||||
**/
|
||||
void
|
||||
gimp_babl_object_free (const Babl *object)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
EXPORTS
|
||||
gimp_adaptive_supersample_area
|
||||
gimp_babl_format_get_type
|
||||
gimp_bilinear
|
||||
gimp_bilinear_16
|
||||
gimp_bilinear_32
|
||||
|
|
|
@ -95,6 +95,33 @@ GParamSpec * gimp_param_spec_color_from_string (const gchar *name,
|
|||
|
||||
gboolean gimp_param_spec_color_has_alpha (GParamSpec *pspec);
|
||||
|
||||
|
||||
/*
|
||||
* GIMP_TYPE_BABL_FORMAT
|
||||
*/
|
||||
|
||||
/**
|
||||
* GimpBablFormat:
|
||||
*
|
||||
* This type is simply a wrapper around [struct@Babl.Object] when used as
|
||||
* a color format.
|
||||
*
|
||||
* The only reason of this wrapper is to be able to assign a %GType to
|
||||
* Babl formats, e.g. to have typed `GValue`, which is mostly used
|
||||
* internally by our plug-in protocol.
|
||||
*
|
||||
* There is no reason whatsoever to use this type directly.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
typedef const Babl * GimpBablFormat;
|
||||
|
||||
#define GIMP_TYPE_BABL_FORMAT gimp_babl_format_get_type ()
|
||||
#define GIMP_VALUE_HOLDS_BABL_FORMAT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_BABL_FORMAT))
|
||||
|
||||
GType gimp_babl_format_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_COLOR_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue