| 1 | /* sxiv: image.h |
| 2 | * Copyright (c) 2011 Bert Muennich <be.muennich at googlemail.com> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU General Public License as published by the |
| 6 | * Free Software Foundation; either version 2 of the License, or (at your |
| 7 | * option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but |
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along |
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | */ |
| 18 | |
| 19 | #ifndef IMAGE_H |
| 20 | #define IMAGE_H |
| 21 | |
| 22 | #include <Imlib2.h> |
| 23 | |
| 24 | #include "types.h" |
| 25 | #include "window.h" |
| 26 | |
| 27 | typedef struct { |
| 28 | Imlib_Image *im; |
| 29 | unsigned int delay; |
| 30 | } img_frame_t; |
| 31 | |
| 32 | typedef struct { |
| 33 | img_frame_t *frames; |
| 34 | int cap; |
| 35 | int cnt; |
| 36 | int sel; |
| 37 | bool animate; |
| 38 | } multi_img_t; |
| 39 | |
| 40 | typedef struct { |
| 41 | Imlib_Image *im; |
| 42 | int w; |
| 43 | int h; |
| 44 | |
| 45 | win_t *win; |
| 46 | float x; |
| 47 | float y; |
| 48 | |
| 49 | scalemode_t scalemode; |
| 50 | float zoom; |
| 51 | |
| 52 | bool re; |
| 53 | bool checkpan; |
| 54 | bool dirty; |
| 55 | bool aa; |
| 56 | bool alpha; |
| 57 | |
| 58 | bool slideshow; |
| 59 | int ss_delay; /* in ms */ |
| 60 | |
| 61 | multi_img_t multi; |
| 62 | } img_t; |
| 63 | |
| 64 | void img_init(img_t*, win_t*); |
| 65 | |
| 66 | bool img_load(img_t*, const fileinfo_t*); |
| 67 | void img_close(img_t*, bool); |
| 68 | |
| 69 | void img_render(img_t*); |
| 70 | |
| 71 | bool img_fit_win(img_t*); |
| 72 | bool img_center(img_t*); |
| 73 | |
| 74 | bool img_zoom(img_t*, float); |
| 75 | bool img_zoom_in(img_t*); |
| 76 | bool img_zoom_out(img_t*); |
| 77 | |
| 78 | bool img_move(img_t*, float, float); |
| 79 | bool img_pan(img_t*, direction_t, int); |
| 80 | bool img_pan_edge(img_t*, direction_t); |
| 81 | |
| 82 | void img_rotate_left(img_t*); |
| 83 | void img_rotate_right(img_t*); |
| 84 | |
| 85 | void img_toggle_antialias(img_t*); |
| 86 | |
| 87 | bool img_frame_navigate(img_t*, int); |
| 88 | bool img_frame_animate(img_t*, bool); |
| 89 | |
| 90 | #endif /* IMAGE_H */ |