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