| 1 | /* sxiv: image.h |
| 2 | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, 5th 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 | int cap; |
| 29 | int cnt; |
| 30 | int cur; |
| 31 | Imlib_Image **frames; |
| 32 | } multi_img_t; |
| 33 | |
| 34 | typedef struct { |
| 35 | Imlib_Image *im; |
| 36 | multi_img_t multi; |
| 37 | |
| 38 | float zoom; |
| 39 | scalemode_t scalemode; |
| 40 | |
| 41 | unsigned char re; |
| 42 | unsigned char checkpan; |
| 43 | unsigned char aa; |
| 44 | unsigned char alpha; |
| 45 | |
| 46 | int x; |
| 47 | int y; |
| 48 | int w; |
| 49 | int h; |
| 50 | } img_t; |
| 51 | |
| 52 | void img_init(img_t*, win_t*); |
| 53 | |
| 54 | int img_load(img_t*, const fileinfo_t*); |
| 55 | void img_close(img_t*, int); |
| 56 | |
| 57 | void img_render(img_t*, win_t*); |
| 58 | |
| 59 | int img_change_frame(img_t*, int); |
| 60 | |
| 61 | int img_fit_win(img_t*, win_t*); |
| 62 | int img_center(img_t*, win_t*); |
| 63 | |
| 64 | int img_zoom(img_t*, win_t*, float); |
| 65 | int img_zoom_in(img_t*, win_t*); |
| 66 | int img_zoom_out(img_t*, win_t*); |
| 67 | |
| 68 | int img_move(img_t*, win_t*, int, int); |
| 69 | int img_pan(img_t*, win_t*, direction_t, int); |
| 70 | int img_pan_edge(img_t*, win_t*, direction_t); |
| 71 | |
| 72 | void img_rotate_left(img_t*, win_t*); |
| 73 | void img_rotate_right(img_t*, win_t*); |
| 74 | |
| 75 | void img_toggle_antialias(img_t*); |
| 76 | |
| 77 | #endif /* IMAGE_H */ |