Code

GSoC C++-ificiation merge and cleanup.
[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 ### P A C K E D    P I X E L     M A P
98 #########################################################################*/
101 typedef struct PackedPixelMap_def PackedPixelMap;
103 /**
104  *
105  */
106 struct PackedPixelMap_def
109     /*#################
110     ### METHODS
111     #################*/
113     /**
114      *
115      */
116     void (*setPixel)(PackedPixelMap *me, int x, int y, int r, int g, int b);
119     /**
120      *
121      */
122     void (*setPixelLong)(PackedPixelMap *me, int x, int y, unsigned long rgb);
125     /**
126      *
127      */
128     unsigned long (*getPixel)(PackedPixelMap *me, int x, int y);
131     /**
132      *
133      */
134     int (*writePPM)(PackedPixelMap *me, char *fileName);
138     /**
139      *
140      */
141     void (*destroy)(PackedPixelMap *me);
145     /*#################
146     ### FIELDS
147     #################*/
149     /**
150      *
151      */
152     int width;
154     /**
155      *
156      */
157     int height;
159     /**
160      * The allocated array of pixels
161      */
162     unsigned long *pixels;
164     /**
165      * Pointers to the beginning of each row of pixels
166      */
167     unsigned long **rows;
170 };
174 #ifdef __cplusplus
175 extern "C" {
176 #endif
178 PackedPixelMap *PackedPixelMapCreate(int width, int height);
180 #ifdef __cplusplus
182 #endif
186 /*#########################################################################
187 ### R G B   M A P
188 #########################################################################*/
190 typedef struct
192     unsigned char r;
193     unsigned char g;
194     unsigned char b;
195 } RGB;
199 typedef struct RgbMap_def RgbMap;
201 /**
202  *
203  */
204 struct RgbMap_def
207     /*#################
208     ### METHODS
209     #################*/
211     /**
212      *
213      */
214     void (*setPixel)(RgbMap *me, int x, int y, int r, int g, int b);
217     /**
218      *
219      */
220     void (*setPixelRGB)(RgbMap *me, int x, int y, RGB rgb);
222     /**
223      *
224      */
225     RGB (*getPixel)(RgbMap *me, int x, int y);
227     /**
228      *
229      */
230     int (*writePPM)(RgbMap *me, char *fileName);
234     /**
235      *
236      */
237     void (*destroy)(RgbMap *me);
241     /*#################
242     ### FIELDS
243     #################*/
245     /**
246      *
247      */
248     int width;
250     /**
251      *
252      */
253     int height;
255     /**
256      * The allocated array of pixels
257      */
258     RGB *pixels;
260     /**
261      * Pointers to the beginning of each row of pixels
262      */
263     RGB **rows;
265 };
269 #ifdef __cplusplus
270 extern "C" {
271 #endif
273 RgbMap *RgbMapCreate(int width, int height);
275 #ifdef __cplusplus
277 #endif
282 /*#########################################################################
283 ### I N D E X E D     M A P
284 #########################################################################*/
287 typedef struct IndexedMap_def IndexedMap;
289 /**
290  *
291  */
292 struct IndexedMap_def
295     /*#################
296     ### METHODS
297     #################*/
299     /**
300      *
301      */
302     void (*setPixel)(IndexedMap *me, int x, int y, unsigned int index);
305     /**
306      *
307      */
308     unsigned int (*getPixel)(IndexedMap *me, int x, int y);
310     /**
311      *
312      */
313     RGB (*getPixelValue)(IndexedMap *me, int x, int y);
315     /**
316      *
317      */
318     int (*writePPM)(IndexedMap *me, char *fileName);
322     /**
323      *
324      */
325     void (*destroy)(IndexedMap *me);
329     /*#################
330     ### FIELDS
331     #################*/
333     /**
334      *
335      */
336     int width;
338     /**
339      *
340      */
341     int height;
343     /**
344      * The allocated array of pixels
345      */
346     unsigned int *pixels;
348     /**
349      * Pointers to the beginning of each row of pixels
350      */
351     unsigned int **rows;
353     /**
354      *
355      */
356     int nrColors;
358     /**
359      * Color look up table
360      */
361     RGB clut[256];
363 };
367 #ifdef __cplusplus
368 extern "C" {
369 #endif
371 IndexedMap *IndexedMapCreate(int width, int height);
373 #ifdef __cplusplus
375 #endif
380 #endif /* __IMAGEMAP_H__ */
382 /*#########################################################################
383 ### E N D    O F    F I L E
384 #########################################################################*/