comparison doodle/gtk/cairo.d @ 80:b759414d2b72

Switched from cairo to Drawable abstraction
author "David Bryant <bagnose@gmail.com>"
date Sun, 15 Aug 2010 23:43:04 +0930
parents 535bae7a7305
children d92b9f04b1e8
comparison
equal deleted inserted replaced
79:535bae7a7305 80:b759414d2b72
1 module doodle.gtk.cairo; 1 module doodle.gtk.cairo;
2 2
3 public { 3 public {
4 import doodle.tk.drawing; 4 import doodle.tk.drawable;
5 import cairo.Context; 5 import cairo.Context;
6 } 6 }
7 7
8 final class CairoDrawable : Drawable { 8 final class CairoDrawable : Drawable {
9 this(Context cr) { 9 this(Context cr) {
40 void popState() { _cr.restore; } 40 void popState() { _cr.restore; }
41 41
42 void drawRectangle(in Rectangle rectangle, bool fill) { 42 void drawRectangle(in Rectangle rectangle, bool fill) {
43 _cr.rectangle(rectangle.position.x, rectangle.position.y, 43 _cr.rectangle(rectangle.position.x, rectangle.position.y,
44 rectangle.size.x, rectangle.size.y); 44 rectangle.size.x, rectangle.size.y);
45 if (fill) { _cr.fill; } else { _cr.stroke; }
45 } 46 }
46 47
47 void drawEllipse(in Rectangle rectangle, bool fill) { 48 void drawEllipse(in Rectangle rectangle, bool fill) {
48 // NYI 49 // NYI
49 } 50 }