Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added horizontal and vertical flip commands

  • Loading branch information...
commit ba0a5b89fa1e9147c60ddb8bbc2b1bcbe2995cd8 1 parent 56b6d23
@baskerville baskerville authored
View
1  README.md
@@ -122,6 +122,7 @@ The following additional key commands are available in *image mode*:
(also with Ctrl-arrow keys)
<,> Rotate image (counter-)clockwise by 90 degrees
+ \,| Flip image horizontally/vertically
s Toggle slideshow
Ctrl-'-' Decrease slideshow delay
View
15 commands.c
@@ -342,6 +342,21 @@ bool i_rotate(arg_t a) {
return false;
}
+bool i_flip(arg_t a) {
+ flip_t flp = (flip_t) a;
+
+ if (mode == MODE_IMAGE) {
+ if (flp == FLIP_HORIZONTAL) {
+ img_flip_horizontal(&img);
+ return true;
+ } else if (flp == FLIP_VERTICAL) {
+ img_flip_vertical(&img);
+ return true;
+ }
+ }
+ return false;
+}
+
bool i_toggle_antialias(arg_t a) {
if (mode == MODE_IMAGE) {
img_toggle_antialias(&img);
View
1  commands.h
@@ -61,6 +61,7 @@ bool i_set_zoom(arg_t);
bool i_fit_to_win(arg_t);
bool i_fit_to_img(arg_t);
bool i_rotate(arg_t);
+bool i_flip(arg_t);
bool i_toggle_slideshow(arg_t);
bool i_adjust_slideshow(arg_t);
bool i_reset_slideshow(arg_t);
View
3  config.def.h
@@ -113,6 +113,9 @@ static const keymap_t keys[] = {
{ false, XK_less, i_rotate, (arg_t) DIR_LEFT },
{ false, XK_greater, i_rotate, (arg_t) DIR_RIGHT },
+ { false, XK_backslash, i_flip, (arg_t) FLIP_HORIZONTAL },
+ { false, XK_bar, i_flip, (arg_t) FLIP_VERTICAL },
+
{ false, XK_a, i_toggle_antialias, (arg_t) None },
{ false, XK_A, it_toggle_alpha, (arg_t) None },
View
20 image.c
@@ -642,6 +642,26 @@ void img_rotate_right(img_t *img) {
img_rotate(img, 1);
}
+void img_flip(img_t *img, int f) {
+ if (img == NULL || img->im == NULL || img->win == NULL)
+ return;
+
+ imlib_context_set_image(img->im);
+ if (f == 0)
+ imlib_image_flip_horizontal();
+ else
+ imlib_image_flip_vertical();
+ img->dirty = true;
+}
+
+void img_flip_horizontal(img_t *img) {
+ img_flip(img, 0);
+}
+
+void img_flip_vertical(img_t *img) {
+ img_flip(img, 1);
+}
+
void img_toggle_antialias(img_t *img) {
if (img == NULL || img->im == NULL)
return;
View
5 image.h
@@ -76,9 +76,14 @@ bool img_move(img_t*, float, float);
bool img_pan(img_t*, direction_t, int);
bool img_pan_edge(img_t*, direction_t);
+void img_rotate(img_t*, int);
void img_rotate_left(img_t*);
void img_rotate_right(img_t*);
+void img_flip(img_t*, int);
+void img_flip_horizontal(img_t*);
+void img_flip_vertical(img_t*);
+
void img_toggle_antialias(img_t*);
bool img_frame_navigate(img_t*, int);
View
7 sxiv.1
@@ -238,6 +238,13 @@ Rotate image counter-clockwise by 90 degrees.
.TP
.B >
Rotate image clockwise by 90 degrees.
+.SS Flip
+.TP
+.B \\\\
+Flip image horizontally.
+.TP
+.B |
+Flip image vertically.
.SS Slideshow
.TP
.B s
View
5 types.h
@@ -24,6 +24,11 @@ typedef enum {
} direction_t;
typedef enum {
+ FLIP_HORIZONTAL,
+ FLIP_VERTICAL
+} flip_t;
+
+typedef enum {
SCALE_DOWN,
SCALE_FIT,
SCALE_ZOOM
Please sign in to comment.
Something went wrong with that request. Please try again.