aboutsummaryrefslogtreecommitdiffstats
path: root/fbi.c
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 /fbi.c
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
Diffstat (limited to 'fbi.c')
-rw-r--r--fbi.c35
1 files changed, 34 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 */