comparison src/image.hh @ 0:6ee11bf9e3ea

Initial revision
author jcid
date Sun, 07 Oct 2007 00:36:34 +0200
parents
children 17f7b0db59ca
comparison
equal deleted inserted replaced
-1:000000000000 0:6ee11bf9e3ea
1 #ifndef __IMAGE_HH__
2 #define __IMAGE_HH__
3
4 // The DilloImage data-structure and methods
5
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif /* __cplusplus */
10
11
12 #include "bitvec.h"
13 #include "url.h"
14
15 typedef struct _DilloImage DilloImage;
16
17 typedef enum {
18 DILLO_IMG_TYPE_INDEXED,
19 DILLO_IMG_TYPE_RGB,
20 DILLO_IMG_TYPE_GRAY,
21 DILLO_IMG_TYPE_NOTSET /* Initial value */
22 } DilloImgType;
23
24 /* These will reflect the Image's "state" */
25 typedef enum {
26 IMG_Empty, /* Just created the entry */
27 IMG_SetParms, /* Parameters set */
28 IMG_SetCmap, /* Color map set */
29 IMG_Write, /* Feeding the entry */
30 IMG_Close, /* Whole image got! */
31 IMG_Abort /* Image transfer aborted */
32 } ImageState;
33
34 struct _DilloImage {
35 void *dw;
36
37 /* Parameters as told by image data */
38 uint_t width;
39 uint_t height;
40
41 const uchar_t *cmap; /* Color map (only for indexed) */
42 DilloImgType in_type; /* Image Type */
43 int32_t bg_color; /* Background color */
44
45 int ProcessedBytes; /* Amount of bytes already decoded */
46 bitvec_t *BitVec; /* Bit vector for decoded rows */
47 ImageState State;
48
49 int RefCount; /* Reference counter */
50 };
51
52
53 /*
54 * Function prototypes
55 */
56 DilloImage *a_Image_new(int width, int height,
57 const char *alt_text, int32_t bg_color);
58 void a_Image_ref(DilloImage *Image);
59 void a_Image_unref(DilloImage *Image);
60
61 void a_Image_set_parms(DilloImage *Image, void *v_imgbuf, DilloUrl *url,
62 int version, uint_t width, uint_t height,
63 DilloImgType type);
64 void a_Image_set_cmap(DilloImage *Image, const uchar_t *cmap);
65 void a_Image_write(DilloImage *Image, void *v_imgbuf,
66 const uchar_t *buf, uint_t y, int decode);
67 void a_Image_close(DilloImage *Image);
68
69 void a_Image_imgbuf_ref(void *v_imgbuf);
70 void a_Image_imgbuf_unref(void *v_imgbuf);
71 void *a_Image_imgbuf_new(void *v_dw, int img_type, int width, int height) ;
72 int a_Image_imgbuf_last_reference(void *v_imgbuf);
73
74 #ifdef __cplusplus
75 }
76 #endif /* __cplusplus */
77
78 #endif /* __IMAGE_HH__ */
79