aboutsummaryrefslogtreecommitdiffstats
path: root/fbi.c
diff options
context:
space:
mode:
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 */