Mercurial > projects > doodle
annotate doodle/tk/cairo.d @ 73:6f2525e170f2
Cairo/OpenGL checkpoint
author | "David Bryant <bagnose@gmail.com>" |
---|---|
date | Sun, 15 Aug 2010 01:02:15 +0930 |
parents | doodle/cairo/routines.d@43cc2135ced0 |
children |
rev | line source |
---|---|
73 | 1 module doodle.tk.cairo; |
2 | |
3 // THIS module is deprecated | |
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
4 |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
11
diff
changeset
|
5 public { |
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
26
diff
changeset
|
6 import doodle.tk.geometry; |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
11
diff
changeset
|
7 import cairo.Context; |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
11
diff
changeset
|
8 } |
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
9 |
26 | 10 void rectangle(scope Context cr, in Rectangle rectangle) { |
10 | 11 cr.rectangle(rectangle.position.x, rectangle.position.y, |
12 rectangle.size.x, rectangle.size.y); | |
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
13 } |
35 | 14 |
15 void line(scope Context cr, in double x0, in double y0, in double x1, in double y1) { | |
16 cr.moveTo(x0, y0); | |
17 cr.lineTo(x1, y1); | |
18 } | |
38
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
19 |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
20 // Horizontal line |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
21 void hline(scope Context cr, in double y, double x0, double x1) { |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
22 cr.moveTo(x0, y); |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
23 cr.lineTo(x1, y); |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
24 } |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
25 |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
26 // Vertical line |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
27 void vline(scope Context cr, in double x, double y0, double y1) { |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
28 cr.moveTo(x, y0); |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
29 cr.lineTo(x, y1); |
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
30 } |