84
|
1 module doodle.tk.renderer;
|
73
|
2
|
|
3 public {
|
|
4 import doodle.tk.geometry;
|
79
|
5 import doodle.tk.color;
|
73
|
6 }
|
|
7
|
84
|
8 interface Renderer {
|
73
|
9 enum LineStyle {
|
|
10 SOLID,
|
|
11 DASHED,
|
|
12 DOTTED
|
|
13 }
|
|
14
|
79
|
15 enum FontFace {
|
|
16 NORMAL
|
|
17 }
|
|
18
|
|
19 // Low-level state manipulation
|
73
|
20
|
79
|
21 void setLineStyle(LineStyle style);
|
|
22 void setLineWidth(in double width);
|
|
23 void setColor(in Color color);
|
|
24
|
|
25 void translate(in Point p);
|
|
26 void scale(in double s);
|
73
|
27
|
|
28 void pushState(); // Copies all of current state
|
|
29 void popState(); // Restores all of previous state
|
|
30
|
79
|
31 // High-level drawing routines
|
73
|
32
|
79
|
33 void drawRectangle(in Rectangle rectangle, bool fill);
|
|
34 void drawEllipse(in Rectangle rectangle, bool fill);
|
|
35 void drawSegment(in Segment segment);
|
|
36 void drawHLine(in double y, in double x0, in double x1);
|
|
37 void drawVLine(in double x, in double y0, in double y1);
|
|
38 void drawPoly(in Point[] points, bool fill);
|
|
39
|
|
40 // Text routines
|
|
41
|
|
42 void setFontFace(in FontFace face);
|
|
43 void setFontSize(in double size);
|
73
|
44 void drawText(in string text);
|
|
45
|
79
|
46 void measureText(in string text, out Rectangle logicalBounds, out Rectangle totalBounds) const;
|
73
|
47 }
|