Procházet zdrojové kódy

Added horizontal and vertical flip commands

master
baskerville před 12 roky
rodič
revize
ba0a5b89fa
8 změnil soubory, kde provedl 57 přidání a 0 odebrání
  1. +1
    -0
      README.md
  2. +15
    -0
      commands.c
  3. +1
    -0
      commands.h
  4. +3
    -0
      config.def.h
  5. +20
    -0
      image.c
  6. +5
    -0
      image.h
  7. +7
    -0
      sxiv.1
  8. +5
    -0
      types.h

+ 1
- 0
README.md Zobrazit soubor

@@ -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


+ 15
- 0
commands.c Zobrazit soubor

@@ -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);


+ 1
- 0
commands.h Zobrazit soubor

@@ -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);


+ 3
- 0
config.def.h Zobrazit soubor

@@ -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 },



+ 20
- 0
image.c Zobrazit soubor

@@ -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;


+ 5
- 0
image.h Zobrazit soubor

@@ -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);


+ 7
- 0
sxiv.1 Zobrazit soubor

@@ -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


+ 5
- 0
types.h Zobrazit soubor

@@ -23,6 +23,11 @@ typedef enum {
DIR_DOWN
} direction_t;

typedef enum {
FLIP_HORIZONTAL,
FLIP_VERTICAL
} flip_t;

typedef enum {
SCALE_DOWN,
SCALE_FIT,


Načítá se…
Zrušit
Uložit