From dd45e3b462cd8dd79efc60ef36ba4ac2fc9af5fd Mon Sep 17 00:00:00 2001 From: Jacob Boerema Date: Fri, 10 Nov 2023 13:40:29 -0500 Subject: [PATCH] plug-ins: add option to vertically flip dds image on import Some games apparently need dds images to be vertically flipped. We already have an option to flip dds images on export, so it makes sense to also allow flipping on import. --- plug-ins/file-dds/dds.c | 6 ++++++ plug-ins/file-dds/ddsread.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/plug-ins/file-dds/dds.c b/plug-ins/file-dds/dds.c index fd22dd4c6e..e5f174e0fb 100644 --- a/plug-ins/file-dds/dds.c +++ b/plug-ins/file-dds/dds.c @@ -170,6 +170,12 @@ dds_create_procedure (GimpPlugIn *plug_in, TRUE, G_PARAM_READWRITE); + GIMP_PROC_ARG_BOOLEAN (procedure, "flip-image", + _("Flip image _vertically"), + _("Flip the image vertically on import"), + FALSE, + G_PARAM_READWRITE); + GIMP_PROC_ARG_BOOLEAN (procedure, "decode-images", _("Automatically decode YCoCg/AE_xp images when detected"), _("Decode YCoCg/AExp images when detected"), diff --git a/plug-ins/file-dds/ddsread.c b/plug-ins/file-dds/ddsread.c index d104b00e8a..7a56279816 100644 --- a/plug-ins/file-dds/ddsread.c +++ b/plug-ins/file-dds/ddsread.c @@ -138,6 +138,7 @@ read_dds (GFile *file, gboolean decode_images; gint i, j; guint computed_pitch_or_linsize; + gboolean flip_import; if (interactive) { @@ -149,6 +150,7 @@ read_dds (GFile *file, g_object_get (config, "load-mipmaps", &read_mipmaps, + "flip-image", &flip_import, "decode-images", &decode_images, NULL); @@ -730,6 +732,9 @@ read_dds (GFile *file, gimp_image_take_selected_layers (image, layers); + if (flip_import) + gimp_image_flip (image, GIMP_ORIENTATION_VERTICAL); + *ret_image = image; return GIMP_PDB_SUCCESS; @@ -2007,6 +2012,7 @@ load_dialog (GimpProcedure *procedure, vbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog), "dds-read-box", "load-mipmaps", + "flip-image", "decode-images", NULL); gtk_box_set_spacing (GTK_BOX (vbox), 8);