mirror of https://github.com/GNOME/gimp.git
app: add gimp_gegl_get_op_enum_type() to get the GType of a gegl enum
and use it in convert-precision-dialog.c
This commit is contained in:
parent
ca5391f42f
commit
5b86b55e2a
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "dialogs-types.h"
|
||||
|
||||
#include "gegl/gimp-gegl-utils.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
@ -88,8 +90,6 @@ convert_precision_dialog_new (GimpImage *image,
|
|||
GtkSizeGroup *size_group;
|
||||
const gchar *enum_desc;
|
||||
gchar *blurb;
|
||||
GType operation_type;
|
||||
GParamSpec *dither_pspec;
|
||||
GType dither_type;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
@ -155,10 +155,8 @@ convert_precision_dialog_new (GimpImage *image,
|
|||
|
||||
/* dithering */
|
||||
|
||||
operation_type = gegl_operation_gtype_from_name ("gegl:color-reduction");
|
||||
dither_pspec = g_object_class_find_property (g_type_class_peek (operation_type),
|
||||
dither_type = gimp_gegl_get_op_enum_type ("gegl:color-reduction",
|
||||
"dither-strategy");
|
||||
dither_type = G_TYPE_FROM_CLASS (G_PARAM_SPEC_ENUM (dither_pspec)->enum_class);
|
||||
|
||||
frame = gimp_frame_new (_("Dithering"));
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
|
|
|
@ -45,6 +45,34 @@ gimp_interpolation_to_gegl_filter (GimpInterpolationType interpolation)
|
|||
return "nearest";
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_gegl_get_op_enum_type (const gchar *operation,
|
||||
const gchar *property)
|
||||
{
|
||||
GeglNode *node;
|
||||
GObject *op;
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_return_val_if_fail (operation != NULL, G_TYPE_NONE);
|
||||
g_return_val_if_fail (property != NULL, G_TYPE_NONE);
|
||||
|
||||
node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", operation,
|
||||
NULL);
|
||||
g_object_get (node, "gegl-operation", &op, NULL);
|
||||
g_object_unref (node);
|
||||
|
||||
g_return_val_if_fail (op != NULL, G_TYPE_NONE);
|
||||
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (op), property);
|
||||
|
||||
g_return_val_if_fail (G_IS_PARAM_SPEC_ENUM (pspec), G_TYPE_NONE);
|
||||
|
||||
g_object_unref (op);
|
||||
|
||||
return G_TYPE_FROM_CLASS (G_PARAM_SPEC_ENUM (pspec)->enum_class);
|
||||
}
|
||||
|
||||
GeglColor *
|
||||
gimp_gegl_color_new (const GimpRGB *rgb)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
|
||||
const gchar * gimp_interpolation_to_gegl_filter (GimpInterpolationType interpolation) G_GNUC_CONST;
|
||||
|
||||
GType gimp_gegl_get_op_enum_type (const gchar *operation,
|
||||
const gchar *property);
|
||||
|
||||
GeglColor * gimp_gegl_color_new (const GimpRGB *rgb);
|
||||
|
||||
void gimp_gegl_progress_connect (GeglNode *node,
|
||||
|
|
Loading…
Reference in New Issue