aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Aulery <lkppo@free.fr>2012-01-28 21:54:54 +0100
committerGerd Hoffmann <kraxel@redhat.com>2012-02-10 14:12:23 +0100
commita822c6b4c3088d89b969f7e1e3fa39c6be0f2b70 (patch)
tree8499e41a1a1ba272b618954827a4880f008dcf97
parentfdcf4afdf57fe671c20700e07aae9dd290fd3acb (diff)
downloadfbida-a822c6b4c3088d89b969f7e1e3fa39c6be0f2b70.tar.gz
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
-rw-r--r--fbi.c35
-rw-r--r--fbi.man6
-rw-r--r--fbi.man.fr6
3 files changed, 46 insertions, 1 deletions
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