1 /** \file
2  * \brief World Coordinate Functions
3  *
4  * See Copyright Notice in cd.h
5  */
6 module cd.wd;
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 int  wdCanvasPlay(cdCanvas* canvas, cdContext* context, double xmin, double xmax, double ymin, double ymax, void* data);
18 
19 /* coordinate transformation */
20 void wdCanvasWindow(cdCanvas* canvas, double xmin, double xmax, double  ymin, double ymax);
21 void wdCanvasGetWindow(cdCanvas* canvas, double* xmin, double* xmax,  double* ymin, double* ymax);
22 void wdCanvasViewport(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
23 void wdCanvasGetViewport(cdCanvas* canvas, int* xmin, int* xmax,  int* ymin, int* ymax);
24 void wdCanvasWorld2Canvas(cdCanvas* canvas, double xw, double yw, int* xv, int* yv);
25 void wdCanvasWorld2CanvasSize(cdCanvas* canvas, double hw, double vw, int* hv, int* vv);
26 void wdCanvasCanvas2World(cdCanvas* canvas, int xv, int yv, double* xw, double* yw);
27 void wdCanvasSetTransform(cdCanvas* canvas, double sx, double sy, double tx, double ty);
28 void wdCanvasGetTransform(cdCanvas* canvas, double* sx, double* sy, double* tx, double* ty);
29 void wdCanvasTranslate(cdCanvas* canvas, double dtx, double dty);
30 void wdCanvasScale(cdCanvas* canvas, double dsx, double dsy);
31 
32 void wdCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double  ymin, double ymax);
33 int  wdCanvasGetClipArea(cdCanvas* canvas, double* xmin, double* xmax, double* ymin, double* ymax);
34 int  wdCanvasIsPointInRegion(cdCanvas* canvas, double x, double y);
35 void wdCanvasOffsetRegion(cdCanvas* canvas, double x, double y);
36 void wdCanvasGetRegionBox(cdCanvas* canvas, double* xmin, double* xmax, double* ymin, double* ymax);
37 
38 void wdCanvasHardcopy(cdCanvas* canvas, cdContext* ctx, void* data, void function(cdCanvas* canvas_copy) draw_func);
39 
40 /* primitives */
41 void wdCanvasPixel(cdCanvas* canvas, double x, double y, c_long color);
42 void wdCanvasMark(cdCanvas* canvas, double x, double y);
43 void wdCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2);
44 void wdCanvasVertex(cdCanvas* canvas, double x, double y);
45 void wdCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
46 void wdCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
47 void wdCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
48 void wdCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
49 void wdCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
50 void wdCanvasText(cdCanvas* canvas, double x, double y, const(char)* s);
51 
52 void wdCanvasGetImageRGB(cdCanvas* canvas, ubyte* r, ubyte* g, ubyte* b, double x, double y, int iw, int ih);
53 void wdCanvasPutImageRectRGB(cdCanvas* canvas, 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);
54 void wdCanvasPutImageRectRGBA(cdCanvas* canvas, 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);
55 void wdCanvasPutImageRectMap(cdCanvas* canvas, 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);
56 
57 void wdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax);
58 
59 void wdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, double x, double y, double w, double h);
60 
61 /* attributes */
62 double wdCanvasLineWidth(cdCanvas* canvas, double width);
63 int wdCanvasFont(cdCanvas* canvas, const(char)* type_face, int style, double size);
64 void wdCanvasGetFont(cdCanvas* canvas, char* type_face, int* style, double* size);
65 double wdCanvasMarkSize(cdCanvas* canvas, double size);
66 void wdCanvasGetFontDim(cdCanvas* canvas, double* max_width, double* height, double* ascent, double* descent);
67 void wdCanvasGetTextSize(cdCanvas* canvas, const(char)* s, double* width, double* height);
68 void wdCanvasGetTextBox(cdCanvas* canvas, double x, double y, const(char)* s, double* xmin, double* xmax, double* ymin, double* ymax);
69 void wdCanvasGetTextBounds(cdCanvas* canvas, double x, double y, const(char)* s, double* rect);
70 void wdCanvasStipple(cdCanvas* canvas, int w, int h, const(ubyte)* fgbg, double w_mm, double h_mm);
71 void wdCanvasPattern(cdCanvas* canvas, int w, int h, const(c_long)* color, double w_mm, double h_mm);
72 
73 /* vector text */
74 void wdCanvasVectorTextDirection(cdCanvas* canvas, double x1, double y1, double x2, double y2);
75 void wdCanvasVectorTextSize(cdCanvas* canvas, double size_x, double size_y, const(char)* s);
76 void wdCanvasGetVectorTextSize(cdCanvas* canvas, const(char)* s, double* x, double* y);
77 double wdCanvasVectorCharSize(cdCanvas* canvas, double size);
78 void wdCanvasVectorText(cdCanvas* canvas, double x, double y, const(char)* s);
79 void wdCanvasMultiLineVectorText(cdCanvas* canvas, double x, double y, const(char)* s);
80 void wdCanvasGetVectorTextBounds(cdCanvas* canvas, const(char)* s, double x, double y, double* rect);
81 void wdCanvasGetVectorTextBox(cdCanvas* canvas, double x, double y, const(char)* s, double* xmin, double* xmax, double* ymin, double* ymax);
82 
83 }
84 
85 version(CD_NO_OLD_INTERFACE)
86 	{}
87 else
88 	public import cd.wd_old;