annotate src/image.hh @ 104:ed71c7b5ea92

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