view cairo_support.d @ 3:7d57cae10805

Renamed geometry2 to geometry
author David Bryant <daveb@acres.com.au>
date Fri, 10 Jul 2009 15:25:48 +0930
parents d6f44347373d
children 71ca82e0eb76
line wrap: on
line source

module cairo_support;

import tk.geometry;

import cairo.Context;

void rectangle(Context cr, Point corner1, Point corner2) {
    double x = corner1.x;
    double y = corner1.y;
    double w = corner2.x - corner1.x;
    double h = corner2.y - corner1.y;

    if (w < 0.0) { x += w; w = -w; }
    if (h < 0.0) { y += h; h = -h; }

    //writefln("Rect: %f %f %f %f\n", x, y, w, h);

    cr.rectangle(x, y, w, h);
}