Added horizontal and vertical flip commands
This commit is contained in:
parent
56b6d23c0c
commit
ba0a5b89fa
|
@ -122,6 +122,7 @@ The following additional key commands are available in *image mode*:
|
||||||
(also with Ctrl-arrow keys)
|
(also with Ctrl-arrow keys)
|
||||||
|
|
||||||
<,> Rotate image (counter-)clockwise by 90 degrees
|
<,> Rotate image (counter-)clockwise by 90 degrees
|
||||||
|
\,| Flip image horizontally/vertically
|
||||||
|
|
||||||
s Toggle slideshow
|
s Toggle slideshow
|
||||||
Ctrl-'-' Decrease slideshow delay
|
Ctrl-'-' Decrease slideshow delay
|
||||||
|
|
15
commands.c
15
commands.c
|
@ -342,6 +342,21 @@ bool i_rotate(arg_t a) {
|
||||||
return false;
|
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) {
|
bool i_toggle_antialias(arg_t a) {
|
||||||
if (mode == MODE_IMAGE) {
|
if (mode == MODE_IMAGE) {
|
||||||
img_toggle_antialias(&img);
|
img_toggle_antialias(&img);
|
||||||
|
|
|
@ -61,6 +61,7 @@ bool i_set_zoom(arg_t);
|
||||||
bool i_fit_to_win(arg_t);
|
bool i_fit_to_win(arg_t);
|
||||||
bool i_fit_to_img(arg_t);
|
bool i_fit_to_img(arg_t);
|
||||||
bool i_rotate(arg_t);
|
bool i_rotate(arg_t);
|
||||||
|
bool i_flip(arg_t);
|
||||||
bool i_toggle_slideshow(arg_t);
|
bool i_toggle_slideshow(arg_t);
|
||||||
bool i_adjust_slideshow(arg_t);
|
bool i_adjust_slideshow(arg_t);
|
||||||
bool i_reset_slideshow(arg_t);
|
bool i_reset_slideshow(arg_t);
|
||||||
|
|
|
@ -113,6 +113,9 @@ static const keymap_t keys[] = {
|
||||||
{ false, XK_less, i_rotate, (arg_t) DIR_LEFT },
|
{ false, XK_less, i_rotate, (arg_t) DIR_LEFT },
|
||||||
{ false, XK_greater, i_rotate, (arg_t) DIR_RIGHT },
|
{ 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, i_toggle_antialias, (arg_t) None },
|
||||||
{ false, XK_A, it_toggle_alpha, (arg_t) None },
|
{ false, XK_A, it_toggle_alpha, (arg_t) None },
|
||||||
|
|
||||||
|
|
20
image.c
20
image.c
|
@ -642,6 +642,26 @@ void img_rotate_right(img_t *img) {
|
||||||
img_rotate(img, 1);
|
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) {
|
void img_toggle_antialias(img_t *img) {
|
||||||
if (img == NULL || img->im == NULL)
|
if (img == NULL || img->im == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
5
image.h
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(img_t*, direction_t, int);
|
||||||
bool img_pan_edge(img_t*, direction_t);
|
bool img_pan_edge(img_t*, direction_t);
|
||||||
|
|
||||||
|
void img_rotate(img_t*, int);
|
||||||
void img_rotate_left(img_t*);
|
void img_rotate_left(img_t*);
|
||||||
void img_rotate_right(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*);
|
void img_toggle_antialias(img_t*);
|
||||||
|
|
||||||
bool img_frame_navigate(img_t*, int);
|
bool img_frame_navigate(img_t*, int);
|
||||||
|
|
7
sxiv.1
7
sxiv.1
|
@ -238,6 +238,13 @@ Rotate image counter-clockwise by 90 degrees.
|
||||||
.TP
|
.TP
|
||||||
.B >
|
.B >
|
||||||
Rotate image clockwise by 90 degrees.
|
Rotate image clockwise by 90 degrees.
|
||||||
|
.SS Flip
|
||||||
|
.TP
|
||||||
|
.B \\\\
|
||||||
|
Flip image horizontally.
|
||||||
|
.TP
|
||||||
|
.B |
|
||||||
|
Flip image vertically.
|
||||||
.SS Slideshow
|
.SS Slideshow
|
||||||
.TP
|
.TP
|
||||||
.B s
|
.B s
|
||||||
|
|
Loading…
Reference in a new issue