static GValueArray * displays_reconnect_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args) { gboolean success = TRUE; GimpImage *old_image; GimpImage *new_image; old_image = gimp_value_get_image (&args->values[0], gimp); new_image = gimp_value_get_image (&args->values[1], gimp); if (success) { success = (old_image != new_image && old_image->disp_count > 0 && new_image->disp_count == 0); if (success) { gimp_reconnect_displays (gimp, old_image, new_image); /* take ownership of the image */ if (new_image->disp_count > 0) g_object_unref (new_image); } } return gimp_procedure_get_return_values (procedure, success); }
static GimpValueArray * image_resize_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gint32 new_width; gint32 new_height; gint32 offx; gint32 offy; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); new_width = g_value_get_int (gimp_value_array_index (args, 1)); new_height = g_value_get_int (gimp_value_array_index (args, 2)); offx = g_value_get_int (gimp_value_array_index (args, 3)); offy = g_value_get_int (gimp_value_array_index (args, 4)); if (success) { gimp_image_resize (image, context, new_width, new_height, offx, offy, NULL); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * image_convert_precision_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gint32 precision; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); precision = g_value_get_enum (gimp_value_array_index (args, 1)); if (success) { if (gimp->plug_in_manager->current_plug_in) gimp_plug_in_enable_precision (gimp->plug_in_manager->current_plug_in); if (gimp_pdb_image_is_not_base_type (image, GIMP_INDEXED, error) && gimp_pdb_image_is_not_precision (image, precision, error)) { gimp_image_convert_precision (image, precision, 0, 0, 0, NULL); } else { success = FALSE; } } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GValueArray * image_parasite_list_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GValueArray *return_vals; GimpImage *image; gint32 num_parasites = 0; gchar **parasites = NULL; image = gimp_value_get_image (&args->values[0], gimp); if (success) { parasites = gimp_image_parasite_list (image, &num_parasites); } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) { g_value_set_int (&return_vals->values[1], num_parasites); gimp_value_take_stringarray (&return_vals->values[2], parasites, num_parasites); } return return_vals; }
static GimpValueArray * image_get_guide_position_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpImage *image; gint32 guide; gint32 position = 0; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); guide = g_value_get_uint (gimp_value_array_index (args, 1)); if (success) { GimpGuide *g = gimp_pdb_image_get_guide (image, guide, error); if (g) position = gimp_guide_get_position (g); else success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_int (gimp_value_array_index (return_vals, 1), position); return return_vals; }
static GValueArray * image_get_guide_position_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args) { gboolean success = TRUE; GValueArray *return_vals; GimpImage *image; gint32 guide; gint32 position = 0; image = gimp_value_get_image (&args->values[0], gimp); guide = g_value_get_uint (&args->values[1]); if (success) { GimpGuide *g = gimp_image_get_guide (image, guide); if (g) position = gimp_guide_get_position (g); else success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success); if (success) g_value_set_int (&return_vals->values[1], position); return return_vals; }
static GValueArray * image_delete_guide_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args) { gboolean success = TRUE; GimpImage *image; gint32 guide; image = gimp_value_get_image (&args->values[0], gimp); guide = g_value_get_uint (&args->values[1]); if (success) { GimpGuide *g = gimp_image_get_guide (image, guide); if (g) gimp_image_remove_guide (image, g, TRUE); else success = FALSE; } return gimp_procedure_get_return_values (procedure, success); }
static GValueArray * image_undo_group_start_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; image = gimp_value_get_image (&args->values[0], gimp); if (success) { GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in; const gchar *undo_desc = NULL; if (plug_in) { success = gimp_plug_in_cleanup_undo_group_start (plug_in, image); if (success) undo_desc = gimp_plug_in_get_undo_desc (plug_in); } if (success) gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_MISC, undo_desc); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GValueArray * image_grid_set_background_color_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; GimpRGB bgcolor; image = gimp_value_get_image (&args->values[0], gimp); gimp_value_get_rgb (&args->values[1], &bgcolor); if (success) { GimpGrid *grid = gimp_image_get_grid (image); if (grid) g_object_set (grid, "bgcolor", &bgcolor, NULL); else success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GValueArray * image_grid_get_background_color_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GValueArray *return_vals; GimpImage *image; GimpRGB bgcolor = { 0.0, 0.0, 0.0, 1.0 }; image = gimp_value_get_image (&args->values[0], gimp); if (success) { GimpGrid *grid = gimp_image_get_grid (image); if (grid) bgcolor = grid->bgcolor; else success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) gimp_value_set_rgb (&return_vals->values[1], &bgcolor); return return_vals; }
static GimpValueArray * image_grid_get_style_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpImage *image; gint32 style = 0; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); if (success) { GimpGrid *grid = gimp_image_get_grid (image); if (grid) g_object_get (grid, "style", &style, NULL); else success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_enum (gimp_value_array_index (return_vals, 1), style); return return_vals; }
static GimpValueArray * image_grid_set_foreground_color_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; GimpRGB fgcolor; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); gimp_value_get_rgb (gimp_value_array_index (args, 1), &fgcolor); if (success) { GimpGrid *grid = gimp_image_get_grid (image); if (grid) g_object_set (grid, "fgcolor", &fgcolor, NULL); else success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * image_grid_get_foreground_color_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpImage *image; GimpRGB fgcolor = { 0.0, 0.0, 0.0, 1.0 }; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); if (success) { GimpGrid *grid = gimp_image_get_grid (image); if (grid) fgcolor = grid->fgcolor; else success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &fgcolor); return return_vals; }
static GimpValueArray * image_grid_set_offset_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gdouble xoffset; gdouble yoffset; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); xoffset = g_value_get_double (gimp_value_array_index (args, 1)); yoffset = g_value_get_double (gimp_value_array_index (args, 2)); if (success) { GimpGrid *grid = gimp_image_get_grid (image); if (grid) g_object_set (grid, "xoffset", xoffset, "yoffset", yoffset, NULL); else success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * image_scale_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gint32 new_width; gint32 new_height; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); new_width = g_value_get_int (gimp_value_array_index (args, 1)); new_height = g_value_get_int (gimp_value_array_index (args, 2)); if (success) { GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); if (progress) gimp_progress_start (progress, FALSE, _("Scaling")); gimp_image_scale (image, new_width, new_height, pdb_context->interpolation, progress); if (progress) gimp_progress_end (progress); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * selection_save_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpImage *image; GimpChannel *channel = NULL; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); if (success) { channel = gimp_selection_save (GIMP_SELECTION (gimp_image_get_mask (image))); if (! channel) success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) gimp_value_set_channel (gimp_value_array_index (return_vals, 1), channel); return return_vals; }
static GValueArray * image_undo_is_enabled_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GValueArray *return_vals; GimpImage *image; gboolean enabled = FALSE; image = gimp_value_get_image (&args->values[0], gimp); if (success) { enabled = gimp_image_undo_is_enabled (image); } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_boolean (&return_vals->values[1], enabled); return return_vals; }
static GValueArray * image_grid_set_style_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gint32 style; image = gimp_value_get_image (&args->values[0], gimp); style = g_value_get_enum (&args->values[1]); if (success) { GimpGrid *grid = gimp_image_get_grid (image); if (grid) g_object_set (grid, "style", style, NULL); else success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GValueArray * image_undo_group_end_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; image = gimp_value_get_image (&args->values[0], gimp); if (success) { GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in; if (plug_in) success = gimp_plug_in_cleanup_undo_group_end (plug_in, image); if (success) gimp_image_undo_group_end (image); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GValueArray * image_grid_set_spacing_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gdouble xspacing; gdouble yspacing; image = gimp_value_get_image (&args->values[0], gimp); xspacing = g_value_get_double (&args->values[1]); yspacing = g_value_get_double (&args->values[2]); if (success) { GimpGrid *grid = gimp_image_get_grid (image); if (grid) g_object_set (grid, "xspacing", xspacing, "yspacing", yspacing, NULL); else success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GValueArray * image_find_next_guide_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args) { gboolean success = TRUE; GValueArray *return_vals; GimpImage *image; gint32 guide; gint32 next_guide = 0; image = gimp_value_get_image (&args->values[0], gimp); guide = g_value_get_uint (&args->values[1]); if (success) { GimpGuide *g = gimp_image_get_next_guide (image, guide, &success); if (g) next_guide = gimp_guide_get_ID (g); } return_vals = gimp_procedure_get_return_values (procedure, success); if (success) g_value_set_uint (&return_vals->values[1], next_guide); return return_vals; }
static GValueArray * selection_save_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GValueArray *return_vals; GimpImage *image; GimpChannel *channel = NULL; image = gimp_value_get_image (&args->values[0], gimp); if (success) { channel = gimp_selection_save (gimp_image_get_mask (image)); if (! channel) success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) gimp_value_set_channel (&return_vals->values[1], channel); return return_vals; }
static GimpValueArray * image_delete_guide_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gint32 guide; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); guide = g_value_get_uint (gimp_value_array_index (args, 1)); if (success) { GimpGuide *g = gimp_pdb_image_get_guide (image, guide, error); if (g) gimp_image_remove_guide (image, g, TRUE); else success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GValueArray * selection_value_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GValueArray *return_vals; GimpImage *image; gint32 x; gint32 y; gint32 value = 0; image = gimp_value_get_image (&args->values[0], gimp); x = g_value_get_int (&args->values[1]); y = g_value_get_int (&args->values[2]); if (success) { value = gimp_pickable_get_opacity_at (GIMP_PICKABLE (gimp_image_get_mask (image)), x, y); } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_int (&return_vals->values[1], value); return return_vals; }
static GValueArray * image_parasite_find_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args, GError **error) { gboolean success = TRUE; GValueArray *return_vals; GimpImage *image; const gchar *name; GimpParasite *parasite = NULL; image = gimp_value_get_image (&args->values[0], gimp); name = g_value_get_string (&args->values[1]); if (success) { parasite = gimp_parasite_copy (gimp_image_parasite_find (image, name)); if (! parasite) success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_take_boxed (&return_vals->values[1], parasite); return return_vals; }
static GimpValueArray * selection_is_empty_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpImage *image; gboolean is_empty = FALSE; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); if (success) { is_empty = gimp_channel_is_empty (gimp_image_get_mask (image)); } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_boolean (gimp_value_array_index (return_vals, 1), is_empty); return return_vals; }
static GimpValueArray * selection_translate_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gint32 offx; gint32 offy; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); offx = g_value_get_int (gimp_value_array_index (args, 1)); offy = g_value_get_int (gimp_value_array_index (args, 2)); if (success) { gimp_item_translate (GIMP_ITEM (gimp_image_get_mask (image)), offx, offy, TRUE); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * selection_border_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gint32 radius; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); radius = g_value_get_int (gimp_value_array_index (args, 1)); if (success) { /* FIXME: "feather" and "edge-lock" hardcoded to TRUE */ gimp_channel_border (gimp_image_get_mask (image), radius, radius, TRUE, TRUE, TRUE); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * image_convert_grayscale_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); if (success) { if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error)) { success = gimp_image_convert_type (image, GIMP_GRAY, 0, 0, FALSE, FALSE, FALSE, 0, NULL, NULL, error); } else { success = FALSE; } } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * image_rotate_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gint32 rotate_type; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); rotate_type = g_value_get_enum (gimp_value_array_index (args, 1)); if (success) { if (progress) gimp_progress_start (progress, FALSE, _("Rotating")); gimp_image_rotate (image, context, rotate_type, progress); if (progress) gimp_progress_end (progress); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }