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