]> mj.ucw.cz Git - libucw.git/blob - images/images.h
Merge with git+ssh://cvs.ucw.cz/projects/sherlock/GIT/sherlock.git
[libucw.git] / images / images.h
1 #ifndef _IMAGES_IMAGES_H
2 #define _IMAGES_IMAGES_H
3
4 enum image_flag {
5   IMAGE_GRAYSCALE = 0x1,        /* grayscale image */
6 };
7
8 struct image_data {
9   uns flags;                    /* enum image_flag */
10   uns width;                    /* number of columns */
11   uns height;                   /* number of rows */
12   uns size;                     /* buffer size in bytes */
13   byte *pixels;                 /* RGB */
14 };
15
16 #if 0
17
18 enum image_format {
19   IMAGE_FORMAT_UNDEFINED = 0,
20   IMAGE_FORMAT_JPEG,
21   IMAGE_FORMAT_PNG,
22   IMAGE_FORMAT_GIF
23 };
24
25 struct image_io {
26   struct mempool *pool;
27   struct fastbuf *fb;
28   enum image_format format;
29   struct image_data image;
30   void *internals;
31   union {
32     struct {
33     } jpeg;
34     struct {
35     } png;
36     struct {
37     } gif;
38   };
39 };
40
41 void image_open(struct image_io *io, struct fastbuf *fb, struct mempool *pool);
42 void image_close(struct image_io *io);
43 int image_read_header(struct image_io *io);
44 int image_read_data(struct image_io *io);
45 int image_read(struct image_io *io);
46 int image_write(struct image_io *io);
47
48 #endif
49
50 #endif
51