~vaifrax/inkscape/bugfix170049

« back to all changes in this revision

Viewing changes to src/trace/imagemap.h

  • Committer: mental
  • Date: 2006-01-16 02:36:01 UTC
  • Revision ID: mental@users.sourceforge.net-20060116023601-wkr0h7edl5veyudq
moving trunk for module inkscape

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __IMAGEMAP_H__
 
2
#define __IMAGEMAP_H__
 
3
 
 
4
#ifndef TRUE
 
5
#define TRUE  1
 
6
#endif
 
7
 
 
8
#ifndef FALSE
 
9
#define FALSE 0
 
10
#endif
 
11
 
 
12
 
 
13
/*#########################################################################
 
14
### G R A Y M A P
 
15
#########################################################################*/
 
16
 
 
17
 
 
18
typedef struct GrayMap_def GrayMap;
 
19
 
 
20
#define GRAYMAP_BLACK 0
 
21
#define GRAYMAP_WHITE 765
 
22
 
 
23
/**
 
24
 *
 
25
 */
 
26
struct GrayMap_def
 
27
{
 
28
 
 
29
    /*#################
 
30
    ### METHODS
 
31
    #################*/
 
32
 
 
33
    /**
 
34
     *
 
35
     */
 
36
    void (*setPixel)(GrayMap *me, int x, int y, unsigned long val);
 
37
 
 
38
    /**
 
39
     *
 
40
     */
 
41
    unsigned long (*getPixel)(GrayMap *me, int x, int y);
 
42
 
 
43
    /**
 
44
     *
 
45
     */
 
46
    int (*writePPM)(GrayMap *me, char *fileName);
 
47
 
 
48
 
 
49
 
 
50
    /**
 
51
     *
 
52
     */
 
53
    void (*destroy)(GrayMap *me);
 
54
 
 
55
 
 
56
 
 
57
    /*#################
 
58
    ### FIELDS
 
59
    #################*/
 
60
 
 
61
    /**
 
62
     *
 
63
     */
 
64
    int width;
 
65
 
 
66
    /**
 
67
     *
 
68
     */
 
69
    int height;
 
70
 
 
71
    /**
 
72
     *  The pixel array
 
73
     */
 
74
    unsigned long *pixels;
 
75
 
 
76
    /**
 
77
     *  Pointer to the beginning of each row
 
78
     */
 
79
    unsigned long **rows;
 
80
 
 
81
};
 
82
 
 
83
#ifdef __cplusplus
 
84
extern "C" {
 
85
#endif
 
86
 
 
87
GrayMap *GrayMapCreate(int width, int height);
 
88
 
 
89
#ifdef __cplusplus
 
90
}
 
91
#endif
 
92
 
 
93
 
 
94
 
 
95
 
 
96
/*#########################################################################
 
97
### R G B   M A P
 
98
#########################################################################*/
 
99
 
 
100
typedef struct
 
101
{
 
102
    unsigned char r;
 
103
    unsigned char g;
 
104
    unsigned char b;
 
105
} RGB;
 
106
 
 
107
 
 
108
 
 
109
typedef struct RgbMap_def RgbMap;
 
110
 
 
111
/**
 
112
 *
 
113
 */
 
114
struct RgbMap_def
 
115
{
 
116
 
 
117
    /*#################
 
118
    ### METHODS
 
119
    #################*/
 
120
 
 
121
    /**
 
122
     *
 
123
     */
 
124
    void (*setPixel)(RgbMap *me, int x, int y, int r, int g, int b);
 
125
 
 
126
 
 
127
    /**
 
128
     *
 
129
     */
 
130
    void (*setPixelRGB)(RgbMap *me, int x, int y, RGB rgb);
 
131
 
 
132
    /**
 
133
     *
 
134
     */
 
135
    RGB (*getPixel)(RgbMap *me, int x, int y);
 
136
 
 
137
    /**
 
138
     *
 
139
     */
 
140
    int (*writePPM)(RgbMap *me, char *fileName);
 
141
 
 
142
 
 
143
 
 
144
    /**
 
145
     *
 
146
     */
 
147
    void (*destroy)(RgbMap *me);
 
148
 
 
149
 
 
150
 
 
151
    /*#################
 
152
    ### FIELDS
 
153
    #################*/
 
154
 
 
155
    /**
 
156
     *
 
157
     */
 
158
    int width;
 
159
 
 
160
    /**
 
161
     *
 
162
     */
 
163
    int height;
 
164
 
 
165
    /**
 
166
     * The allocated array of pixels
 
167
     */
 
168
    RGB *pixels;
 
169
 
 
170
    /**
 
171
     * Pointers to the beginning of each row of pixels
 
172
     */
 
173
    RGB **rows;
 
174
 
 
175
};
 
176
 
 
177
 
 
178
 
 
179
#ifdef __cplusplus
 
180
extern "C" {
 
181
#endif
 
182
 
 
183
RgbMap *RgbMapCreate(int width, int height);
 
184
 
 
185
#ifdef __cplusplus
 
186
}
 
187
#endif
 
188
 
 
189
 
 
190
 
 
191
 
 
192
/*#########################################################################
 
193
### I N D E X E D     M A P
 
194
#########################################################################*/
 
195
 
 
196
 
 
197
typedef struct IndexedMap_def IndexedMap;
 
198
 
 
199
/**
 
200
 *
 
201
 */
 
202
struct IndexedMap_def
 
203
{
 
204
 
 
205
    /*#################
 
206
    ### METHODS
 
207
    #################*/
 
208
 
 
209
    /**
 
210
     *
 
211
     */
 
212
    void (*setPixel)(IndexedMap *me, int x, int y, unsigned int index);
 
213
 
 
214
 
 
215
    /**
 
216
     *
 
217
     */
 
218
    unsigned int (*getPixel)(IndexedMap *me, int x, int y);
 
219
 
 
220
    /**
 
221
     *
 
222
     */
 
223
    RGB (*getPixelValue)(IndexedMap *me, int x, int y);
 
224
 
 
225
    /**
 
226
     *
 
227
     */
 
228
    int (*writePPM)(IndexedMap *me, char *fileName);
 
229
 
 
230
 
 
231
 
 
232
    /**
 
233
     *
 
234
     */
 
235
    void (*destroy)(IndexedMap *me);
 
236
 
 
237
 
 
238
 
 
239
    /*#################
 
240
    ### FIELDS
 
241
    #################*/
 
242
 
 
243
    /**
 
244
     *
 
245
     */
 
246
    int width;
 
247
 
 
248
    /**
 
249
     *
 
250
     */
 
251
    int height;
 
252
 
 
253
    /**
 
254
     * The allocated array of pixels
 
255
     */
 
256
    unsigned int *pixels;
 
257
 
 
258
    /**
 
259
     * Pointers to the beginning of each row of pixels
 
260
     */
 
261
    unsigned int **rows;
 
262
 
 
263
    /**
 
264
     *
 
265
     */
 
266
    int nrColors;
 
267
    
 
268
    /**
 
269
     * Color look up table
 
270
     */
 
271
    RGB clut[256];
 
272
 
 
273
};
 
274
 
 
275
 
 
276
 
 
277
#ifdef __cplusplus
 
278
extern "C" {
 
279
#endif
 
280
 
 
281
IndexedMap *IndexedMapCreate(int width, int height);
 
282
 
 
283
#ifdef __cplusplus
 
284
}
 
285
#endif
 
286
 
 
287
 
 
288
#endif /* __IMAGEMAP_H__ */
 
289
 
 
290
/*#########################################################################
 
291
### E N D    O F    F I L E
 
292
#########################################################################*/