Mercurial > projects > doodle
diff doodle/tk/renderer.d @ 84:cdd4fc728d94
Renamed Drawable to Renderer
author | daveb |
---|---|
date | Mon, 16 Aug 2010 17:23:09 +0930 |
parents | doodle/tk/drawable.d@b759414d2b72 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doodle/tk/renderer.d Mon Aug 16 17:23:09 2010 +0930 @@ -0,0 +1,47 @@ +module doodle.tk.renderer; + +public { + import doodle.tk.geometry; + import doodle.tk.color; +} + +interface Renderer { + enum LineStyle { + SOLID, + DASHED, + DOTTED + } + + enum FontFace { + NORMAL + } + + // Low-level state manipulation + + void setLineStyle(LineStyle style); + void setLineWidth(in double width); + void setColor(in Color color); + + void translate(in Point p); + void scale(in double s); + + void pushState(); // Copies all of current state + void popState(); // Restores all of previous state + + // High-level drawing routines + + void drawRectangle(in Rectangle rectangle, bool fill); + void drawEllipse(in Rectangle rectangle, bool fill); + void drawSegment(in Segment segment); + void drawHLine(in double y, in double x0, in double x1); + void drawVLine(in double x, in double y0, in double y1); + void drawPoly(in Point[] points, bool fill); + + // Text routines + + void setFontFace(in FontFace face); + void setFontSize(in double size); + void drawText(in string text); + + void measureText(in string text, out Rectangle logicalBounds, out Rectangle totalBounds) const; +}