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