summaryrefslogtreecommitdiff
path: root/cd/include/cd.h
blob: 85b02c2af0aa25c76f3413cc431e5817f37987e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
/** \file
 * \brief User API
 * CD - Canvas Draw
 * Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
 * http://www.tecgraf.puc-rio.br/cd	
 * mailto:cd@tecgraf.puc-rio.br
 *
 * See Copyright Notice at the end of this file
 */
 
#ifndef __CD_H
#define __CD_H

#ifdef __cplusplus
extern "C" {
#endif


#define CD_NAME "CD - Canvas Draw"
#define CD_DESCRIPTION "A 2D Graphics Library"
#define CD_COPYRIGHT    "Copyright (C) 1994-2010 Tecgraf, PUC-Rio."
#define CD_VERSION "5.4"              /* bug fixes are reported only by cdVersion functions */
#define CD_VERSION_NUMBER 504000
#define CD_VERSION_DATE "2010/06/24"  /* does not include bug fix releases */

typedef struct _cdContext cdContext;
typedef struct _cdCanvas cdCanvas;
typedef struct _cdCanvas cdState;
typedef struct _cdImage cdImage;

/* client images using bitmap structure */
typedef struct _cdBitmap {
  int w;
  int h;
  int type;
  void *data;
} cdBitmap;


/* library */
char*         cdVersion(void);
char*         cdVersionDate(void);
int           cdVersionNumber(void);

/* canvas init */
cdCanvas*   cdCreateCanvas(cdContext *context, void *data);
cdCanvas*   cdCreateCanvasf(cdContext *context, const char* format, ...);
void        cdKillCanvas(cdCanvas* canvas);

cdContext*  cdCanvasGetContext(cdCanvas* canvas);
int         cdCanvasActivate(cdCanvas* canvas);
void        cdCanvasDeactivate(cdCanvas* canvas);
int         cdUseContextPlus(int use);
void        cdInitContextPlus(void);   /* need an external library */

/* context */
typedef int (*cdCallback)(cdCanvas* canvas, ...);
int cdContextRegisterCallback(cdContext *context, int cb, cdCallback func);
unsigned long cdContextCaps(cdContext *context);

/* control */
int      cdCanvasSimulate(cdCanvas* canvas, int mode);
void     cdCanvasFlush(cdCanvas* canvas);
void     cdCanvasClear(cdCanvas* canvas);
cdState* cdCanvasSaveState(cdCanvas* canvas);
void     cdCanvasRestoreState(cdCanvas* canvas, cdState* state);
void     cdReleaseState(cdState* state);
void     cdCanvasSetAttribute(cdCanvas* canvas, const char* name, char* data);
void     cdCanvasSetfAttribute(cdCanvas* canvas, const char* name, const char* format, ...);
char*    cdCanvasGetAttribute(cdCanvas* canvas, const char* name);

/* interpretation */
int  cdCanvasPlay(cdCanvas* canvas, cdContext *context, int xmin, int xmax, int ymin, int ymax, void *data);

/* coordinate transformation */
void cdCanvasGetSize(cdCanvas* canvas, int *width, int *height, double *width_mm, double *height_mm);
int cdCanvasUpdateYAxis(cdCanvas* canvas, int* y);
double cdfCanvasUpdateYAxis(cdCanvas* canvas, double* y);
int cdCanvasYAxisMode(cdCanvas* canvas, int invert);
int cdCanvasInvertYAxis(cdCanvas* canvas, int y);
double cdfCanvasInvertYAxis(cdCanvas* canvas, double y);
void cdCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, int *dx, int *dy);
void cdCanvasPixel2MM(cdCanvas* canvas, int dx, int dy, double *mm_dx, double *mm_dy);
void cdfCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, double *dx, double *dy);
void cdfCanvasPixel2MM(cdCanvas* canvas, double dx, double dy, double *mm_dx, double *mm_dy);
void cdCanvasOrigin(cdCanvas* canvas, int x, int y);
void cdfCanvasOrigin(cdCanvas* canvas, double x, double y);
void cdCanvasGetOrigin(cdCanvas* canvas, int *x, int *y);
void cdfCanvasGetOrigin(cdCanvas* canvas, double *x, double *y);
void cdCanvasTransform(cdCanvas* canvas, const double* matrix);
double* cdCanvasGetTransform(cdCanvas* canvas);
void cdCanvasTransformMultiply(cdCanvas* canvas, const double* matrix);
void cdCanvasTransformRotate(cdCanvas* canvas, double angle);
void cdCanvasTransformScale(cdCanvas* canvas, double sx, double sy);
void cdCanvasTransformTranslate(cdCanvas* canvas, double dx, double dy);
void cdCanvasTransformPoint(cdCanvas* canvas, int x, int y, int *tx, int *ty);
void cdfCanvasTransformPoint(cdCanvas* canvas, double x, double y, double *tx, double *ty);

/* clipping */
int  cdCanvasClip(cdCanvas* canvas, int mode);
void cdCanvasClipArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
int  cdCanvasGetClipArea(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
void cdfCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
int  cdfCanvasGetClipArea(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);

/* clipping region */
int  cdCanvasIsPointInRegion(cdCanvas* canvas, int x, int y);
void cdCanvasOffsetRegion(cdCanvas* canvas, int x, int y);
void cdCanvasGetRegionBox(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
int  cdCanvasRegionCombineMode(cdCanvas* canvas, int mode);

/* primitives */
void cdCanvasPixel(cdCanvas* canvas, int x, int y, long color);
void cdCanvasMark(cdCanvas* canvas, int x, int y);

void cdCanvasBegin(cdCanvas* canvas, int mode);
void cdCanvasPathSet(cdCanvas* canvas, int action);
void cdCanvasEnd(cdCanvas* canvas);

void cdCanvasLine(cdCanvas* canvas, int x1, int y1, int x2, int y2);
void cdCanvasVertex(cdCanvas* canvas, int x, int y);
void cdCanvasRect(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
void cdCanvasBox(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
void cdCanvasArc(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
void cdCanvasSector(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
void cdCanvasChord(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
void cdCanvasText(cdCanvas* canvas, int x, int y, const char* s);

void cdfCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2);
void cdfCanvasVertex(cdCanvas* canvas, double x, double y);
void cdfCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
void cdfCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
void cdfCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
void cdfCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
void cdfCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
void cdfCanvasText(cdCanvas* canvas, double x, double y, const char* s);

/* attributes */
void cdCanvasSetBackground(cdCanvas* canvas, long color);
void cdCanvasSetForeground(cdCanvas* canvas, long color);
long cdCanvasBackground(cdCanvas* canvas, long color);
long cdCanvasForeground(cdCanvas* canvas, long color);
int  cdCanvasBackOpacity(cdCanvas* canvas, int opacity);
int  cdCanvasWriteMode(cdCanvas* canvas, int mode);
int  cdCanvasLineStyle(cdCanvas* canvas, int style);
void cdCanvasLineStyleDashes(cdCanvas* canvas, const int* dashes, int count);
int  cdCanvasLineWidth(cdCanvas* canvas, int width);
int  cdCanvasLineJoin(cdCanvas* canvas, int join);
int  cdCanvasLineCap(cdCanvas* canvas, int cap);
int  cdCanvasInteriorStyle(cdCanvas* canvas, int style);
int  cdCanvasHatch(cdCanvas* canvas, int style);
void cdCanvasStipple(cdCanvas* canvas, int w, int h, const unsigned char* stipple);
unsigned char* cdCanvasGetStipple(cdCanvas* canvas, int *n, int *m);
void   cdCanvasPattern(cdCanvas* canvas, int w, int h, long const int *pattern);
long*  cdCanvasGetPattern(cdCanvas* canvas, int* n, int* m);
int    cdCanvasFillMode(cdCanvas* canvas, int mode);
int    cdCanvasFont(cdCanvas* canvas, const char* type_face, int style, int size);
void   cdCanvasGetFont(cdCanvas* canvas, char *type_face, int *style, int *size);
char*  cdCanvasNativeFont(cdCanvas* canvas, const char* font);
int    cdCanvasTextAlignment(cdCanvas* canvas, int alignment);
double cdCanvasTextOrientation(cdCanvas* canvas, double angle);
int    cdCanvasMarkType(cdCanvas* canvas, int type);
int    cdCanvasMarkSize(cdCanvas* canvas, int size);

/* vector text */
void cdCanvasVectorText(cdCanvas* canvas, int x, int y, const char* s);
void cdCanvasMultiLineVectorText(cdCanvas* canvas, int x, int y, const char* s);

/* vector text attributes */
char* cdCanvasVectorFont(cdCanvas* canvas, const char *filename);
void  cdCanvasVectorTextDirection(cdCanvas* canvas, int x1, int y1, int x2, int y2);
double* cdCanvasVectorTextTransform(cdCanvas* canvas, const double* matrix);
void  cdCanvasVectorTextSize(cdCanvas* canvas, int size_x, int size_y, const char* s);
int   cdCanvasVectorCharSize(cdCanvas* canvas, int size);
void  cdCanvasVectorFontSize(cdCanvas* canvas, double size_x, double size_y);
void  cdCanvasGetVectorFontSize(cdCanvas* canvas, double *size_x, double *size_y);

/* vector text properties */
void cdCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, int *x, int *y);
void cdCanvasGetVectorTextBounds(cdCanvas* canvas, const char* s, int x, int y, int *rect);
void cdCanvasGetVectorTextBox(cdCanvas* canvas, int x, int y, const char *s, int *xmin, int *xmax, int *ymin, int *ymax);

/* properties */
void cdCanvasGetFontDim(cdCanvas* canvas, int *max_width, int *height, int *ascent, int *descent);
void cdCanvasGetTextSize(cdCanvas* canvas, const char* s, int *width, int *height);
void cdCanvasGetTextBox(cdCanvas* canvas, int x, int y, const char* s, int *xmin, int *xmax, int *ymin, int *ymax);
void cdCanvasGetTextBounds(cdCanvas* canvas, int x, int y, const char* s, int *rect);
int  cdCanvasGetColorPlanes(cdCanvas* canvas);

/* color */
void cdCanvasPalette(cdCanvas* canvas, int n, const long *palette, int mode);

/* client images */
void cdCanvasGetImageRGB(cdCanvas* canvas, unsigned char* r, unsigned char* g, unsigned char* b, int x, int y, int w, int h);
void cdCanvasPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
void cdCanvasPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
void cdCanvasPutImageRectMap(cdCanvas* canvas, int iw, int ih, const unsigned char* index, const long* colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);

/* server images */
cdImage* cdCanvasCreateImage(cdCanvas* canvas, int w, int h);
void cdKillImage(cdImage* image);
void cdCanvasGetImage(cdCanvas* canvas, cdImage* image, int x, int y);
void cdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, int x, int y, int xmin, int xmax, int ymin, int ymax);
void cdCanvasScrollArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax, int dx, int dy);

/* bitmap */
cdBitmap* cdCreateBitmap(int w, int h, int type);
cdBitmap* cdInitBitmap(int w, int h, int type, ...);
void cdKillBitmap(cdBitmap* bitmap);
unsigned char* cdBitmapGetData(cdBitmap* bitmap, int dataptr);
void cdBitmapSetRect(cdBitmap* bitmap, int xmin, int xmax, int ymin, int ymax);
void cdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y, int w, int h);
void cdCanvasGetBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y);
void cdBitmapRGB2Map(cdBitmap* bitmap_rgb, cdBitmap* bitmap_map);

/* color */
long cdEncodeColor(unsigned char red, unsigned char green, unsigned char blue);
void cdDecodeColor(long color, unsigned char* red, unsigned char* green, unsigned char* blue);
unsigned char cdDecodeAlpha(long color);
long cdEncodeAlpha(long color, unsigned char alpha);

#define cdAlpha(_)    (unsigned char)(~(((_) >> 24) & 0xFF))
#define cdReserved(_) (unsigned char)(((_) >> 24) & 0xFF)
#define cdRed(_)      (unsigned char)(((_) >> 16) & 0xFF)
#define cdGreen(_)    (unsigned char)(((_) >>  8) & 0xFF)
#define cdBlue(_)     (unsigned char)(((_) >>  0) & 0xFF)

/* client image color convertion */
void cdRGB2Map(int width, int height, const unsigned char* red, const unsigned char* green, const unsigned char* blue, unsigned char* index, int pal_size, long *color);


/* CD Values */

#define CD_QUERY -1             /* query value */

enum {                        /* bitmap type */
 CD_RGB,                      /* these definitions are compatible with the IM library */
 CD_MAP,
 CD_RGBA = 0x100 
};

enum {                         /* bitmap data */
 CD_IRED,
 CD_IGREEN,
 CD_IBLUE,
 CD_IALPHA,
 CD_INDEX,
 CD_COLORS
};

enum {                          /* status report */
 CD_ERROR = -1,
 CD_OK    =  0
};

enum {                          /* clip mode */
 CD_CLIPOFF,
 CD_CLIPAREA,
 CD_CLIPPOLYGON,
 CD_CLIPREGION
};

enum {                          /* region combine mode */
 CD_UNION,
 CD_INTERSECT,
 CD_DIFFERENCE,
 CD_NOTINTERSECT
};

enum {                          /* polygon mode (begin...end) */
 CD_FILL,
 CD_OPEN_LINES,
 CD_CLOSED_LINES,
 CD_CLIP,
 CD_BEZIER,
 CD_REGION,
 CD_PATH
};

#define CD_POLYCUSTOM 10

enum {                          /* path actions */
 CD_PATH_NEW,
 CD_PATH_MOVETO,
 CD_PATH_LINETO,
 CD_PATH_ARC,
 CD_PATH_CURVETO,
 CD_PATH_CLOSE,
 CD_PATH_FILL,
 CD_PATH_STROKE,
 CD_PATH_FILLSTROKE,
 CD_PATH_CLIP
};

enum {                          /* fill mode */
 CD_EVENODD,
 CD_WINDING
};

enum {                          /* line join  */
 CD_MITER,
 CD_BEVEL,
 CD_ROUND
};  

enum {                          /* line cap  */
 CD_CAPFLAT,  
 CD_CAPSQUARE,
 CD_CAPROUND
};  

enum {                          /* background opacity mode */
 CD_OPAQUE,
 CD_TRANSPARENT
};

enum {                          /* write mode */
 CD_REPLACE,
 CD_XOR,
 CD_NOT_XOR
};

enum {                          /* color allocation mode (palette) */
 CD_POLITE,
 CD_FORCE
};

enum {                          /* line style */
 CD_CONTINUOUS,
 CD_DASHED,
 CD_DOTTED,
 CD_DASH_DOT,
 CD_DASH_DOT_DOT,
 CD_CUSTOM
};

enum {                          /* marker type */
 CD_PLUS,
 CD_STAR,
 CD_CIRCLE,
 CD_X,
 CD_BOX,
 CD_DIAMOND,
 CD_HOLLOW_CIRCLE,
 CD_HOLLOW_BOX,
 CD_HOLLOW_DIAMOND
};

enum {                          /* hatch type */
 CD_HORIZONTAL,
 CD_VERTICAL,
 CD_FDIAGONAL,
 CD_BDIAGONAL,
 CD_CROSS,
 CD_DIAGCROSS
};

enum {                          /* interior style */
 CD_SOLID,
 CD_HATCH,
 CD_STIPPLE,
 CD_PATTERN,
 CD_HOLLOW
};

enum {                          /* text alignment */
 CD_NORTH,
 CD_SOUTH,
 CD_EAST,
 CD_WEST,
 CD_NORTH_EAST,
 CD_NORTH_WEST,
 CD_SOUTH_EAST,
 CD_SOUTH_WEST,
 CD_CENTER,
 CD_BASE_LEFT,
 CD_BASE_CENTER,
 CD_BASE_RIGHT
};

enum {                          /* style */
 CD_PLAIN  = 0,
 CD_BOLD   = 1,
 CD_ITALIC = 2,
 CD_UNDERLINE = 4,
 CD_STRIKEOUT = 8
};

#define CD_BOLD_ITALIC (CD_BOLD|CD_ITALIC)  /* compatibility name */

enum {                          /* some font sizes */
 CD_SMALL    =  8,
 CD_STANDARD = 12,
 CD_LARGE    = 18
};

/* Canvas Capabilities */
#define CD_CAP_NONE             0x00000000
#define CD_CAP_FLUSH            0x00000001
#define CD_CAP_CLEAR            0x00000002
#define CD_CAP_PLAY             0x00000004
#define CD_CAP_YAXIS            0x00000008
#define CD_CAP_CLIPAREA         0x00000010
#define CD_CAP_CLIPPOLY         0x00000020
#define CD_CAP_REGION           0x00000040
#define CD_CAP_RECT             0x00000080
#define CD_CAP_CHORD            0x00000100
#define CD_CAP_IMAGERGB         0x00000200
#define CD_CAP_IMAGERGBA        0x00000400
#define CD_CAP_IMAGEMAP         0x00000800
#define CD_CAP_GETIMAGERGB      0x00001000
#define CD_CAP_IMAGESRV         0x00002000
#define CD_CAP_BACKGROUND       0x00004000
#define CD_CAP_BACKOPACITY      0x00008000
#define CD_CAP_WRITEMODE        0x00010000
#define CD_CAP_LINESTYLE        0x00020000
#define CD_CAP_LINEWITH         0x00040000
#define CD_CAP_FPRIMTIVES       0x00080000
#define CD_CAP_HATCH            0x00100000
#define CD_CAP_STIPPLE          0x00200000
#define CD_CAP_PATTERN          0x00400000
#define CD_CAP_FONT             0x00800000
#define CD_CAP_FONTDIM          0x01000000
#define CD_CAP_TEXTSIZE         0x02000000
#define CD_CAP_TEXTORIENTATION  0x04000000
#define CD_CAP_PALETTE          0x08000000
#define CD_CAP_LINECAP          0x10000000
#define CD_CAP_LINEJOIN         0x20000000
#define CD_CAP_PATH             0x40000000
#define CD_CAP_BEZIER           0x80000000
#define CD_CAP_ALL              0xFFFFFFFF

/* cdPlay definitions */
#define CD_SIZECB 0        /* size callback */
typedef int(*cdSizeCB)(cdCanvas *canvas, int w, int h, double w_mm, double h_mm);
#define CD_ABORT 1
#define CD_CONTINUE 0

/* simulation flags */
#define CD_SIM_NONE         0x0000
#define CD_SIM_LINE         0x0001
#define CD_SIM_RECT         0x0002
#define CD_SIM_BOX          0x0004
#define CD_SIM_ARC          0x0008
#define CD_SIM_SECTOR       0x0010
#define CD_SIM_CHORD        0x0020
#define CD_SIM_POLYLINE     0x0040
#define CD_SIM_POLYGON      0x0080
#define CD_SIM_ALL          0xFFFF

#define CD_SIM_LINES (CD_SIM_LINE | CD_SIM_RECT | CD_SIM_ARC | CD_SIM_POLYLINE)
#define CD_SIM_FILLS (CD_SIM_BOX | CD_SIM_SECTOR | CD_SIM_CHORD | CD_SIM_POLYGON)

/* some predefined colors for convenience */
#define  CD_RED           0xFF0000L   /* 255,  0,  0 */
#define  CD_DARK_RED      0x800000L   /* 128,  0,  0 */
#define  CD_GREEN         0x00FF00L   /*   0,255,  0 */
#define  CD_DARK_GREEN    0x008000L   /*   0,128,  0 */
#define  CD_BLUE          0x0000FFL   /*   0,  0,255 */
#define  CD_DARK_BLUE     0x000080L   /*   0,  0,128 */

#define  CD_YELLOW        0xFFFF00L   /* 255,255,  0 */
#define  CD_DARK_YELLOW   0x808000L   /* 128,128,  0 */
#define  CD_MAGENTA       0xFF00FFL   /* 255,  0,255 */
#define  CD_DARK_MAGENTA  0x800080L   /* 128,  0,128 */
#define  CD_CYAN          0x00FFFFL   /*   0,255,255 */
#define  CD_DARK_CYAN     0x008080L   /*   0,128,128 */

#define  CD_WHITE         0xFFFFFFL   /* 255,255,255 */
#define  CD_BLACK         0x000000L   /*   0,  0,  0 */

#define  CD_DARK_GRAY     0x808080L   /* 128,128,128 */
#define  CD_GRAY          0xC0C0C0L   /* 192,192,192 */

/* some usefull conversion factors */
#define CD_MM2PT     2.834645669   /* milimeters to points (pt = CD_MM2PT * mm) */
#define CD_RAD2DEG  57.295779513   /* radians to degrees (deg = CD_RAD2DEG * rad) */
#define CD_DEG2RAD  0.01745329252  /* degrees to radians (rad = CD_DEG2RAD * deg) */

/* paper sizes */
enum {
  CD_A0,
  CD_A1,
  CD_A2,
  CD_A3,
  CD_A4,
  CD_A5,
  CD_LETTER,
  CD_LEGAL
};


#ifdef __cplusplus
}
#endif


#ifndef CD_NO_OLD_INTERFACE
#include "cd_old.h"
#endif


/******************************************************************************
Copyright (C) 1994-2010 Tecgraf, PUC-Rio.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/

#endif /* ifndef CD_H */