view 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
line wrap: on
line source

module doodle.tk.drawing;

public {
    import doodle.tk.geometry;
    import doodle.tk.color;
}

interface Drawable {
    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;
}