From a822c6b4c3088d89b969f7e1e3fa39c6be0f2b70 Mon Sep 17 00:00:00 2001 From: Stéphane Aulery Date: Sat, 28 Jan 2012 21:54:54 +0100 Subject: Add commands x and y to flip vertically or horizontally Requested by Trent W. Buck in debian bug #526795 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526795 --- fbi.c | 35 ++++++++++++++++++++++++++++++++++- fbi.man | 6 ++++++ fbi.man.fr | 6 ++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/fbi.c b/fbi.c index 336e2bd..a8c6a53 100644 --- a/fbi.c +++ b/fbi.c @@ -77,6 +77,8 @@ #define KEY_DELETE -200 #define KEY_ROT_CW -201 #define KEY_ROT_CCW -202 +#define KEY_FLIP_V -203 +#define KEY_FLIP_H -204 #define DEFAULT_DEVICE "/dev/fb0" @@ -552,6 +554,8 @@ static void show_help(void) L" D, Shift+d - delete image", L" r - rotate 90 degrees clockwise", L" l - rotate 90 degrees counter-clockwise", + L" x - mirror image vertically (top / bottom)", + L" y - mirror image horizontally (left to right)", }; shadow_draw_text_box(face, 24, 16, transparency, @@ -996,7 +1000,13 @@ svga_show(struct flist *f, struct flist *prev, } else if (0 == strcmp(key, "l") || 0 == strcmp(key, "L")) { return KEY_ROT_CCW; - + } else if (0 == strcmp(key, "x") || + 0 == strcmp(key, "X")) { + return KEY_FLIP_V; + } else if (0 == strcmp(key, "y") || + 0 == strcmp(key, "Y")) { + return KEY_FLIP_H; + } else if (0 == strcmp(key, "h") || 0 == strcmp(key, "H")) { if (!help) { @@ -1544,6 +1554,29 @@ main(int argc, char *argv[]) } break; } + case KEY_FLIP_V: + case KEY_FLIP_H: + { + if (editable) { + snprintf(linebuffer,sizeof(linebuffer), + "mirroring %s ...",fcurrent->name); + status_update(linebuffer, NULL); + jpeg_transform_inplace + (fcurrent->name, + (key == KEY_FLIP_V) ? JXFORM_FLIP_V : JXFORM_FLIP_H, + NULL, + NULL,0, + (backup ? JFLAG_FILE_BACKUP : 0) | + (preserve ? JFLAG_FILE_KEEP_TIME : 0) | + JFLAG_TRANSFORM_IMAGE | + JFLAG_TRANSFORM_THUMBNAIL | + JFLAG_UPDATE_ORIENTATION); + flist_img_free(fcurrent); + } else { + status_error("readonly mode, sorry [start with --edit?]"); + } + break; + } case KEY_TAGFILE: fcurrent->tag = !fcurrent->tag; /* fall throuth */ diff --git a/fbi.man b/fbi.man index 5a807c3..5fa8c43 100644 --- a/fbi.man +++ b/fbi.man @@ -215,6 +215,12 @@ Rotate 90 degrees clockwise. .TP \fBl\fP Rotate 90 degrees counter-clock wise. +.TP +\fBx\fP +Mirror image vertically (top / bottom). +.TP +\fBy\fP +Mirror image horizontally (left to right). .P The delete function actually wants a capital letter \fBD\fP, thus you have to type \fBShift+d\fP. This is done to avoid deleting images by mistake because there diff --git a/fbi.man.fr b/fbi.man.fr index 2569b79..db18500 100644 --- a/fbi.man.fr +++ b/fbi.man.fr @@ -227,6 +227,12 @@ Rotation de 90 degrés dans le sens des aiguilles d'une montre. .TP \fBl\fP Rotation de 90 degrés dans le sens contraire des aiguilles d'une montre. +.TP +\fBx\fP +Rotation d'axe horizontal (haut / bas). +.TP +\fBy\fP +Rotation d'axe vertical (gauche / droite). .P La fonction de suppression actuelle nécessite une lettre \fBD\fP en capitale, ainsi vous devez taper \fBShift+d\fP. Ceci évite de supprimer des images par erreur -- cgit