-
Notifications
You must be signed in to change notification settings - Fork 9
/
image.h
57 lines (44 loc) · 1.04 KB
/
image.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef _IMAGE_H_
#define _IMAGE_H_
#include <stdint.h>
#if IMAGICK < 7
#include <wand/MagickWand.h>
#else
#include <MagickWand/MagickWand.h>
#endif
#include "progress.h"
struct img_ctx {
MagickWand* wand;
};
struct img_pixel {
unsigned int x;
unsigned int y;
union {
struct {
uint8_t alpha;
uint8_t blue;
uint8_t green;
uint8_t red;
} color;
uint32_t abgr;
};
};
struct img_frame {
struct img_pixel* pixels;
size_t num_pixels;
unsigned long duration_ms;
};
struct img_animation {
unsigned int width;
unsigned int height;
struct img_frame* frames;
size_t num_frames;
};
int image_alloc(struct img_ctx** ret);
void image_free(struct img_ctx* ctx);
int image_load_animation(struct img_animation** ret, char* fname, progress_cb progress_cb);
void image_free_animation(struct img_animation* anim);
void image_shuffle_frame(struct img_frame* frame);
int image_optimize_animation(struct img_animation* anim, progress_cb progress_cb);
void image_shuffle_animation(struct img_animation* anim, progress_cb progress_cb);
#endif