view cairo_support.d @ 7:936feb16eed4

Checkpoint
author "David Bryant <bagnose@gmail.com>"
date Sat, 11 Jul 2009 21:29:03 +0930
parents 7d57cae10805
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);
}