Mercurial > projects > doodle
annotate page_layer.d @ 17:c643c04e3f5e
Checkpoint
author | David Bryant <daveb@acres.com.au> |
---|---|
date | Mon, 13 Jul 2009 16:46:21 +0930 |
parents | 9e63308b749c |
children | df8d81d9f499 |
rev | line source |
---|---|
17 | 1 module page_layer; |
2 | |
3 private { | |
4 import cairo_support; | |
5 } | |
6 | |
7 public { | |
8 import icanvas; | |
9 } | |
10 | 10 |
11 interface Page { | |
12 } | |
13 | |
14 class PageLayer : Layer, Page { | |
12 | 15 this(in string name) { |
16 super(name); | |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
17 mPageGeometry = Rectangle(Point.DEFAULT, Vector(210.0, 297.0)); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
18 //mPageGeometry = Rectangle(Point.DEFAULT, Vector(100.0, 100.0)); |
11 | 19 } |
20 | |
21 override Rectangle bounds() const { | |
22 return mPageGeometry; | |
23 } | |
24 | |
12 | 25 override void draw(const Viewport viewport, in Rectangle damage, |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
26 Context model_cr, Context pixel_cr) const { |
10 | 27 // Make the paper white, with a border |
28 | |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
29 model_cr.setSourceRgba(1.0, 0.5, 1.0, 0.5); |
12 | 30 rectangle(model_cr, mPageGeometry); |
31 model_cr.fill(); | |
10 | 32 |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
33 model_cr.setSourceRgba(0.3, 0.0, 0.0, 0.5); |
12 | 34 rectangle(model_cr, mPageGeometry); |
35 model_cr.stroke(); | |
36 | |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
37 /* |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
38 pixel_cr.setSourceRgba(1.0, 1.0, 0.5, 0.4); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
39 rectangle(pixel_cr, viewport.model_to_pixel(mPageGeometry)); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
40 pixel_cr.fill(); |
12 | 41 |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
42 pixel_cr.setSourceRgba(0.0, 0.3, 0.0, 0.4); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
43 rectangle(pixel_cr, viewport.model_to_pixel(mPageGeometry)); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
44 //rectangle(pixel_cr, viewport.model_to_pixel(Rectangle(mPageGeometry.position, mPageGeometry.size / 2.0))); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
45 pixel_cr.stroke(); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
46 */ |
10 | 47 } |
48 | |
49 private { | |
11 | 50 Rectangle mPageGeometry; |
10 | 51 } |
52 } |