1 /** \file
2  * \brief Old WC API
3  *
4  * See Copyright Notice in cd.h
5  */
6 
7 module cd.wd_old;
8 
9 import cd.old, cd.cd;
10 
11 extern (C) @safe nothrow:
12 
13 /* coordinate transformation */
14 void wdWindow(double xmin, double xmax, double  ymin, double ymax);
15 void wdGetWindow(double *xmin, double  *xmax,  double  *ymin, double *ymax);
16 void wdViewport(int xmin, int xmax, int ymin, int ymax);
17 void wdGetViewport(int *xmin, int  *xmax,  int  *ymin, int *ymax);
18 void wdWorld2Canvas(double xw, double yw, int *xv, int *yv);
19 void wdWorld2CanvasSize(double hw, double vw, int *hv, int *vv);
20 void wdCanvas2World(int xv, int yv, double *xw, double *yw);
21 
22 void wdClipArea(double xmin, double xmax, double  ymin, double ymax);
23 int  wdGetClipArea(double *xmin, double *xmax, double *ymin, double *ymax);
24 double* wdGetClipPoly(int *n);
25 int  wdPointInRegion(double x, double y);
26 void wdOffsetRegion(double x, double y);
27 void wdRegionBox(double *xmin, double *xmax, double *ymin, double *ymax);
28 
29 void wdHardcopy(cdContext* ctx, void *data, cdCanvas *cnv, void function() draw_func);
30 
31 /* primitives */
32 void wdPixel(double x, double y, long color);
33 void wdMark(double x, double y);
34 void wdLine(double x1, double y1, double x2, double y2);
35 void wdVertex(double x, double y);
36 void wdRect(double xmin, double xmax, double ymin, double ymax);
37 void wdBox(double xmin, double xmax, double ymin, double ymax);
38 void wdArc(double xc, double yc, double w, double h, double angle1, double angle2);
39 void wdSector(double xc, double yc, double w, double h, double angle1, double angle2);
40 void wdChord(double xc, double yc, double w, double h, double angle1, double angle2);
41 void wdText(double x, double y, const char* s);
42 
43 void wdPutImageRect(cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax);
44 void wdPutImageRectRGB(int iw, int ih, const ubyte* r, const ubyte* g, const ubyte* b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
45 void wdPutImageRectRGBA(int iw, int ih, const ubyte* r, const ubyte* g, const ubyte* b, const ubyte* a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
46 void wdPutImageRectMap(int iw, int ih, const ubyte* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
47 void wdPutBitmap(cdBitmap* bitmap, double x, double y, double w, double h);
48 
49 /* attributes */
50 double wdLineWidth(double width);
51 void wdFont(int type_face, int style, double size);
52 void wdGetFont(int *type_face, int *style, double *size);
53 double wdMarkSize(double size);
54 void wdFontDim(double *max_width, double *height, double *ascent, double *descent);
55 void wdTextSize(const char* s, double *width, double *height);
56 void wdTextBox(double x, double y, const char* s, double *xmin, double *xmax, double *ymin, double *ymax);
57 void wdTextBounds(double x, double y, const char* s, double *rect);
58 void wdStipple(int w, int h, const ubyte* stipple, double w_mm, double h_mm);
59 void wdPattern(int w, int h, const long* pattern, double w_mm, double h_mm);
60 
61 /* vector text */
62 void wdVectorTextDirection(double x1, double y1, double x2, double y2);
63 void wdVectorTextSize(double size_x, double size_y, const char* s);
64 void wdGetVectorTextSize(const char* s, double *x, double *y);
65 double wdVectorCharSize(double size);
66 void wdVectorText(double x, double y, const char* s);
67 void wdMultiLineVectorText(double x, double y, const char* s);
68 void wdGetVectorTextBounds(const char* s, double x, double y, double *rect);
69 
70 /* OLD definitions, defined for backward compatibility */
71 alias wdVectorFont = cdVectorFont;
72 alias wdVectorTextTransform = cdVectorTextTransform;
73 alias wdActivate = cdActivate;
74 
75 pragma(inline, true) {
76 
77 void wdClip(T)(auto ref T mode) { cdClip(mode); }
78 void wdBegin(T)(auto ref T mode) { cdBegin(mode); }
79 void wdEnd() { cdEnd(); }
80 
81 
82 void wdMM2Pixel(double mm_dx, double mm_dy, int *dx, int *dy) { return cdMM2Pixel(mm_dx, mm_dy, dx, dy); }
83 void wdPixel2MM(int dx, int dy, double *mm_dx, double *mm_dy) { return cdPixel2MM(dx, dy, mm_dx, mm_dy); }
84 
85 }