annotate src/image.hh @ 2102:e1973d1962c5

rm comment warning about (left|right)-tab
author corvid <corvid@lavabit.com>
date Tue, 21 Jun 2011 00:15:55 +0000
parents e59742ef792a
children
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
1178
97b68213b58e Added a limit for PNG image size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1084
diff changeset
15 /*
97b68213b58e Added a limit for PNG image size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1084
diff changeset
16 * Defines
97b68213b58e Added a limit for PNG image size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1084
diff changeset
17 */
97b68213b58e Added a limit for PNG image size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1084
diff changeset
18
97b68213b58e Added a limit for PNG image size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1084
diff changeset
19 /* Arbitrary maximum for image size (to avoid image size-crafting attacks). */
1202
f77f7973534e use IMAGE_MAX_AREA instead of IMAGE_MAX_W and IMAGE_MAX_H
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1178
diff changeset
20 #define IMAGE_MAX_AREA (6000 * 6000)
1178
97b68213b58e Added a limit for PNG image size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1084
diff changeset
21
97b68213b58e Added a limit for PNG image size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1084
diff changeset
22 /*
97b68213b58e Added a limit for PNG image size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1084
diff changeset
23 * Types
97b68213b58e Added a limit for PNG image size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1084
diff changeset
24 */
97b68213b58e Added a limit for PNG image size
Jorge Arellano Cid <jcid@dillo.org>
parents: 1084
diff changeset
25
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
26 typedef struct _DilloImage DilloImage;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
27
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
28 typedef enum {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
29 DILLO_IMG_TYPE_INDEXED,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
30 DILLO_IMG_TYPE_RGB,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
31 DILLO_IMG_TYPE_GRAY,
1408
e59742ef792a CMYK JPEGs, at least Adobe ones for now
corvid <corvid@lavabit.com>
parents: 1202
diff changeset
32 DILLO_IMG_TYPE_CMYK_INV,
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
33 DILLO_IMG_TYPE_NOTSET /* Initial value */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
34 } DilloImgType;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
35
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
36 /* These will reflect the Image's "state" */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
37 typedef enum {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
38 IMG_Empty, /* Just created the entry */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
39 IMG_SetParms, /* Parameters set */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
40 IMG_SetCmap, /* Color map set */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
41 IMG_Write, /* Feeding the entry */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
42 IMG_Close, /* Whole image got! */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
43 IMG_Abort /* Image transfer aborted */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
44 } ImageState;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
45
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
46 struct _DilloImage {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
47 void *dw;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
48
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
49 /* Parameters as told by image data */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
50 uint_t width;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
51 uint_t height;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
52
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
53 int32_t bg_color; /* Background color */
80
17f7b0db59ca Updated doc/Images.txt
jcid
parents: 0
diff changeset
54 bitvec_t *BitVec; /* Bit vector for decoded rows */
104
ed71c7b5ea92 - Added support for progressive display of progressive jpegs.
jcid
parents: 80
diff changeset
55 uint_t ScanNumber; /* Current decoding scan */
80
17f7b0db59ca Updated doc/Images.txt
jcid
parents: 0
diff changeset
56 ImageState State; /* Processing status */
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
57
80
17f7b0db59ca Updated doc/Images.txt
jcid
parents: 0
diff changeset
58 int RefCount; /* Reference counter */
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
59 };
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
60
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
61
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
62 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
63 * Function prototypes
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
64 */
1084
4d3828de8290 Cleanup in a_Image_new() signature
Jeremy Henty <onepoint@starurchin.org>
parents: 1055
diff changeset
65 DilloImage *a_Image_new(const char *alt_text, int32_t bg_color);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
66 void a_Image_ref(DilloImage *Image);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
67 void a_Image_unref(DilloImage *Image);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
68
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
69 void a_Image_set_parms(DilloImage *Image, void *v_imgbuf, DilloUrl *url,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
70 int version, uint_t width, uint_t height,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
71 DilloImgType type);
708
697145062347 imported patch dicache-cleanup3
Jorge Arellano Cid <jcid@dillo.org>
parents: 703
diff changeset
72 void a_Image_write(DilloImage *Image, uint_t y);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
73 void a_Image_close(DilloImage *Image);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
74
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