Code

Fixing scrollbar size for embeded color swatches.
[inkscape.git] / src / trace / imagemap.h
1 #ifndef __IMAGEMAP_H__
2 #define __IMAGEMAP_H__
4 #ifndef TRUE
5 #define TRUE  1
6 #endif
8 #ifndef FALSE
9 #define FALSE 0
10 #endif
13 /*#########################################################################
14 ### G R A Y M A P
15 #########################################################################*/
18 typedef struct GrayMap_def GrayMap;
20 #define GRAYMAP_BLACK 0
21 #define GRAYMAP_WHITE 765
23 /**
24  *
25  */
26 struct GrayMap_def
27 {
29     /*#################
30     ### METHODS
31     #################*/
33     /**
34      *
35      */
36     void (*setPixel)(GrayMap *me, int x, int y, unsigned long val);
38     /**
39      *
40      */
41     unsigned long (*getPixel)(GrayMap *me, int x, int y);
43     /**
44      *
45      */
46     int (*writePPM)(GrayMap *me, char *fileName);
50     /**
51      *
52      */
53     void (*destroy)(GrayMap *me);
57     /*#################
58     ### FIELDS
59     #################*/
61     /**
62      *
63      */
64     int width;
66     /**
67      *
68      */
69     int height;
71     /**
72      *  The pixel array
73      */
74     unsigned long *pixels;
76     /**
77      *  Pointer to the beginning of each row
78      */
79     unsigned long **rows;
81 };
83 #ifdef __cplusplus
84 extern "C" {
85 #endif
87 GrayMap *GrayMapCreate(int width, int height);
89 #ifdef __cplusplus
90 }
91 #endif
96 /*#########################################################################
97 ### R G B   M A P
98 #########################################################################*/
100 typedef struct
102     unsigned char r;
103     unsigned char g;
104     unsigned char b;
105 } RGB;
109 typedef struct RgbMap_def RgbMap;
111 /**
112  *
113  */
114 struct RgbMap_def
117     /*#################
118     ### METHODS
119     #################*/
121     /**
122      *
123      */
124     void (*setPixel)(RgbMap *me, int x, int y, int r, int g, int b);
127     /**
128      *
129      */
130     void (*setPixelRGB)(RgbMap *me, int x, int y, RGB rgb);
132     /**
133      *
134      */
135     RGB (*getPixel)(RgbMap *me, int x, int y);
137     /**
138      *
139      */
140     int (*writePPM)(RgbMap *me, char *fileName);
144     /**
145      *
146      */
147     void (*destroy)(RgbMap *me);
151     /*#################
152     ### FIELDS
153     #################*/
155     /**
156      *
157      */
158     int width;
160     /**
161      *
162      */
163     int height;
165     /**
166      * The allocated array of pixels
167      */
168     RGB *pixels;
170     /**
171      * Pointers to the beginning of each row of pixels
172      */
173     RGB **rows;
175 };
179 #ifdef __cplusplus
180 extern "C" {
181 #endif
183 RgbMap *RgbMapCreate(int width, int height);
185 #ifdef __cplusplus
187 #endif
192 /*#########################################################################
193 ### I N D E X E D     M A P
194 #########################################################################*/
197 typedef struct IndexedMap_def IndexedMap;
199 /**
200  *
201  */
202 struct IndexedMap_def
205     /*#################
206     ### METHODS
207     #################*/
209     /**
210      *
211      */
212     void (*setPixel)(IndexedMap *me, int x, int y, unsigned int index);
215     /**
216      *
217      */
218     unsigned int (*getPixel)(IndexedMap *me, int x, int y);
220     /**
221      *
222      */
223     RGB (*getPixelValue)(IndexedMap *me, int x, int y);
225     /**
226      *
227      */
228     int (*writePPM)(IndexedMap *me, char *fileName);
232     /**
233      *
234      */
235     void (*destroy)(IndexedMap *me);
239     /*#################
240     ### FIELDS
241     #################*/
243     /**
244      *
245      */
246     int width;
248     /**
249      *
250      */
251     int height;
253     /**
254      * The allocated array of pixels
255      */
256     unsigned int *pixels;
258     /**
259      * Pointers to the beginning of each row of pixels
260      */
261     unsigned int **rows;
263     /**
264      *
265      */
266     int nrColors;
267     
268     /**
269      * Color look up table
270      */
271     RGB clut[256];
273 };
277 #ifdef __cplusplus
278 extern "C" {
279 #endif
281 IndexedMap *IndexedMapCreate(int width, int height);
283 #ifdef __cplusplus
285 #endif
288 #endif /* __IMAGEMAP_H__ */
290 /*#########################################################################
291 ### E N D    O F    F I L E
292 #########################################################################*/