comparison doodle/tk/drawing.d @ 79:535bae7a7305

Checkpoint
author "David Bryant <bagnose@gmail.com>"
date Sun, 15 Aug 2010 23:18:05 +0930
parents 024a5608087f
children
comparison
equal deleted inserted replaced
78:024a5608087f 79:535bae7a7305
1 module doodle.tk.drawing; 1 module doodle.tk.drawing;
2 2
3 public { 3 public {
4 import doodle.tk.geometry; 4 import doodle.tk.geometry;
5 import doodle.tk.color;
5 } 6 }
6 7
7 interface Drawable { 8 interface Drawable {
8 enum LineStyle { 9 enum LineStyle {
9 SOLID, 10 SOLID,
10 DASHED, 11 DASHED,
11 DOTTED 12 DOTTED
12 } 13 }
13 14
15 enum FontFace {
16 NORMAL
17 }
18
19 // Low-level state manipulation
20
14 void setLineStyle(LineStyle style); 21 void setLineStyle(LineStyle style);
15 void setLineThickness(in double thickness); 22 void setLineWidth(in double width);
16 //void setLineColor(in Color color); 23 void setColor(in Color color);
17 //void setFillColor(in Color color); 24
25 void translate(in Point p);
26 void scale(in double s);
27
28 void pushState(); // Copies all of current state
29 void popState(); // Restores all of previous state
30
31 // High-level drawing routines
18 32
19 void drawRectangle(in Rectangle rectangle, bool fill); 33 void drawRectangle(in Rectangle rectangle, bool fill);
20 void drawEllipse(in Rectangle rectangle, bool fill); 34 void drawEllipse(in Rectangle rectangle, bool fill);
21 void drawSegment(in Segment segment); 35 void drawSegment(in Segment segment);
22 void drawHLine(in double y0, in double x0, in double x1); 36 void drawHLine(in double y, in double x0, in double x1);
23 void drawVLine(in double x0, in double y0, in double y1); 37 void drawVLine(in double x, in double y0, in double y1);
24 void drawPoly(in Point[] points, bool fill); 38 void drawPoly(in Point[] points, bool fill);
25 39
26 void pushState(); // Copies all of current state 40 // Text routines
27 void popState(); // Restores all of previous state
28 41
29 void translate(in Vector v); 42 void setFontFace(in FontFace face);
30 void translate(in Point p); 43 void setFontSize(in double size);
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); 44 void drawText(in string text);
37 45
38 void measureText(in string text, out Rectangle logicalBounds, out Rectangle totalBounds); 46 void measureText(in string text, out Rectangle logicalBounds, out Rectangle totalBounds) const;
39
40 // How to fit fonts, metrics, etc in here?
41 // Initially let's just support one font
42 } 47 }