| 1 | /* Copyright 2011 Bert Muennich |
| 2 | * |
| 3 | * This file is part of sxiv. |
| 4 | * |
| 5 | * sxiv is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published |
| 7 | * by the Free Software Foundation; either version 2 of the License, |
| 8 | * or (at your option) any later version. |
| 9 | * |
| 10 | * sxiv is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with sxiv. If not, see <http://www.gnu.org/licenses/>. |
| 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 | int repeat; |
| 39 | } multi_img_t; |
| 40 | |
| 41 | typedef struct { |
| 42 | Imlib_Image im; |
| 43 | int w; |
| 44 | int h; |
| 45 | |
| 46 | win_t *win; |
| 47 | float x; |
| 48 | float y; |
| 49 | |
| 50 | scalemode_t scalemode; |
| 51 | float zoom; |
| 52 | |
| 53 | bool re; |
| 54 | bool checkpan; |
| 55 | bool dirty; |
| 56 | bool aa; |
| 57 | bool alpha; |
| 58 | |
| 59 | Imlib_Color_Modifier cmod; |
| 60 | int gamma; |
| 61 | |
| 62 | multi_img_t multi; |
| 63 | } img_t; |
| 64 | |
| 65 | void img_init(img_t*, win_t*); |
| 66 | |
| 67 | bool img_load(img_t*, const fileinfo_t*); |
| 68 | void img_close(img_t*, bool); |
| 69 | |
| 70 | void img_render(img_t*); |
| 71 | |
| 72 | bool img_fit_win(img_t*, scalemode_t); |
| 73 | bool img_center(img_t*); |
| 74 | |
| 75 | bool img_zoom(img_t*, float); |
| 76 | bool img_zoom_in(img_t*); |
| 77 | bool img_zoom_out(img_t*); |
| 78 | |
| 79 | bool img_move(img_t*, float, float); |
| 80 | bool img_pan(img_t*, direction_t, int); |
| 81 | bool img_pan_edge(img_t*, direction_t); |
| 82 | |
| 83 | void img_rotate(img_t*, degree_t); |
| 84 | void img_flip(img_t*, flipdir_t); |
| 85 | |
| 86 | void img_toggle_antialias(img_t*); |
| 87 | |
| 88 | bool img_change_gamma(img_t*, int); |
| 89 | |
| 90 | bool img_frame_navigate(img_t*, int); |
| 91 | bool img_frame_animate(img_t*, bool); |
| 92 | |
| 93 | #endif /* IMAGE_H */ |