static gboolean apply_fliprotate(fliprotate_settings settings, image_output out) { gboolean success = TRUE; if (settings->flip_h) { // do horizontal flip success = gimp_image_flip ( out->image_id, GIMP_ORIENTATION_HORIZONTAL ); } if (settings->flip_v) { // do vertical flip success = gimp_image_flip ( out->image_id, GIMP_ORIENTATION_VERTICAL ); } if (settings->rotate) { // do rotation success = gimp_image_rotate ( out->image_id, settings->rotation_type ); } return success; }
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); }
void jpeg_exif_rotate (gint32 image_ID, gint orientation) { switch (orientation) { case 1: /* standard orientation, do nothing */ break; case 2: /* flipped right-left */ gimp_image_flip (image_ID, GIMP_ORIENTATION_HORIZONTAL); break; case 3: /* rotated 180 */ gimp_image_rotate (image_ID, GIMP_ROTATE_180); break; case 4: /* flipped top-bottom */ gimp_image_flip (image_ID, GIMP_ORIENTATION_VERTICAL); break; case 5: /* flipped diagonally around '\' */ gimp_image_rotate (image_ID, GIMP_ROTATE_90); jpeg_swap_original_settings (image_ID); gimp_image_flip (image_ID, GIMP_ORIENTATION_HORIZONTAL); break; case 6: /* 90 CW */ gimp_image_rotate (image_ID, GIMP_ROTATE_90); jpeg_swap_original_settings (image_ID); break; case 7: /* flipped diagonally around '/' */ gimp_image_rotate (image_ID, GIMP_ROTATE_90); jpeg_swap_original_settings (image_ID); gimp_image_flip (image_ID, GIMP_ORIENTATION_VERTICAL); break; case 8: /* 90 CCW */ gimp_image_rotate (image_ID, GIMP_ROTATE_270); jpeg_swap_original_settings (image_ID); break; default: /* shouldn't happen */ break; } }
void image_rotate_cmd_callback (GtkAction *action, gint value, gpointer data) { GimpDisplay *display; GimpProgress *progress; return_if_no_display (display, data); progress = gimp_progress_start (GIMP_PROGRESS (display), _("Rotating"), FALSE); gimp_image_rotate (display->image, action_data_get_context (data), (GimpRotationType) value, progress); if (progress) gimp_progress_end (progress); gimp_image_flush (display->image); }