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 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_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, error ? *error : NULL); if (success) g_value_set_int (gimp_value_array_index (return_vals, 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 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_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, error ? *error : NULL); }
GimpGuide * gimp_pdb_image_get_guide (GimpImage *image, gint guide_ID, GError **error) { GimpGuide *guide; g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); guide = gimp_image_get_guide (image, guide_ID); if (guide) return guide; g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT, _("Image '%s' (%d) does not contain guide with ID %d"), gimp_image_get_display_name (image), gimp_image_get_ID (image), guide_ID); return NULL; }