73
|
1 module doodle.tk.drawing;
|
|
2
|
|
3 public {
|
|
4 import doodle.tk.geometry;
|
|
5 }
|
|
6
|
76
|
7 interface Drawable {
|
73
|
8 enum LineStyle {
|
|
9 SOLID,
|
|
10 DASHED,
|
|
11 DOTTED
|
|
12 }
|
|
13
|
|
14 void setLineStyle(LineStyle style);
|
|
15 void setLineThickness(in double thickness);
|
|
16 //void setLineColor(in Color color);
|
|
17 //void setFillColor(in Color color);
|
|
18
|
|
19 void drawRectangle(in Rectangle rectangle, bool fill);
|
|
20 void drawEllipse(in Rectangle rectangle, bool fill);
|
|
21 void drawSegment(in Segment segment);
|
|
22 void drawHLine(in double y0, in double x0, in double x1);
|
|
23 void drawVLine(in double x0, in double y0, in double y1);
|
|
24 void drawPoly(in Point[] points, bool fill);
|
|
25
|
|
26 void pushState(); // Copies all of current state
|
|
27 void popState(); // Restores all of previous state
|
|
28
|
|
29 void translate(in Vector v);
|
|
30 void translate(in Point p);
|
|
31 void scale(in Vector v);
|
|
32 void zoom(in double z);
|
|
33
|
|
34 //void setFontFace;
|
|
35 //void setFontSize;
|
|
36 void drawText(in string text);
|
|
37
|
78
|
38 void measureText(in string text, out Rectangle logicalBounds, out Rectangle totalBounds);
|
|
39
|
73
|
40 // How to fit fonts, metrics, etc in here?
|
78
|
41 // Initially let's just support one font
|
73
|
42 }
|