Krolyxon
Commit 078136d

Branches

Refs →

nsxivimage.h

94 lines · 1.9 KB · Objective-C

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
27typedef struct {
28 Imlib_Image im;
29 unsigned int delay;
30} img_frame_t;
31
32typedef struct {
33 img_frame_t *frames;
34 int cap;
35 int cnt;
36 int sel;
37 bool animate;
38 int anim_repeats; // -1=don't repeat, 0=repeat infinitely, N=repeat N times
39 unsigned int repeats_currently_left;
40} multi_img_t;
41
42typedef struct {
43 Imlib_Image im;
44 int w;
45 int h;
46
47 win_t *win;
48 float x;
49 float y;
50
51 scalemode_t scalemode;
52 float zoom;
53
54 bool re;
55 bool checkpan;
56 bool dirty;
57 bool aa;
58 bool alpha;
59
60 Imlib_Color_Modifier cmod;
61 int gamma;
62
63 multi_img_t multi;
64} img_t;
65
66void img_init(img_t*, win_t*);
67
68bool img_load(img_t*, const fileinfo_t*);
69void img_close(img_t*, bool);
70
71void img_render(img_t*);
72
73bool img_fit_win(img_t*, scalemode_t);
74bool img_center(img_t*);
75
76bool img_zoom(img_t*, float);
77bool img_zoom_in(img_t*);
78bool img_zoom_out(img_t*);
79
80bool img_move(img_t*, float, float);
81bool img_pan(img_t*, direction_t, int);
82bool img_pan_edge(img_t*, direction_t);
83
84void img_rotate(img_t*, degree_t);
85void img_flip(img_t*, flipdir_t);
86
87void img_toggle_antialias(img_t*);
88
89bool img_change_gamma(img_t*, int);
90
91bool img_frame_navigate(img_t*, int);
92bool img_frame_animate(img_t*, bool);
93
94#endif /* IMAGE_H */