comparison doodle/fig/diagram_elements.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 6f2525e170f2
children cdd4fc728d94
comparison
equal deleted inserted replaced
79:535bae7a7305 80:b759414d2b72
1 module doodle.fig.diagram_elements; 1 module doodle.fig.diagram_elements;
2 2
3 private { 3 private {
4 import doodle.tk.geometry; 4 import doodle.tk.geometry;
5 import doodle.tk.cairo; 5 import doodle.tk.drawable;
6 } 6 }
7 7
8 interface IDiagram { 8 interface IDiagram {
9 void add(DiagramElement element); 9 void add(DiagramElement element);
10 } 10 }
11 11
12 abstract class DiagramElement { 12 abstract class DiagramElement {
13 Rectangle bounds() const; 13 Rectangle bounds() const;
14 14
15 void draw(in Rectangle damage, scope Context cr) const; 15 void draw(in Rectangle damage, scope Drawable cr) const;
16 16
17 private { 17 private {
18 //GraphElement _container; // FIXME use an interface to the container 18 //GraphElement _container; // FIXME use an interface to the container
19 } 19 }
20 } 20 }
62 } 62 }
63 } 63 }
64 */ 64 */
65 65
66 final class RectanglePrimitive : GraphicPrimitive { 66 final class RectanglePrimitive : GraphicPrimitive {
67 override void draw(in Rectangle damage, scope Context cr) const { 67 override void draw(in Rectangle damage, scope Drawable drawable) const {
68 rectangle(cr, bounds); 68 drawable.drawRectangle(bounds, false);
69 } 69 }
70 70
71 override Rectangle bounds() const { return _bounds; } 71 override Rectangle bounds() const { return _bounds; }
72 72
73 private { 73 private {