Mercurial > projects > doodle
annotate doodle/dia/layer_stack.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 | c03ed75c0f8e |
children | cdd4fc728d94 |
rev | line source |
---|---|
74 | 1 module doodle.dia.layer_stack; |
2 | |
3 public { | |
4 import doodle.dia.icanvas; | |
5 } | |
6 | |
7 final class LayerStack { | |
8 this(in Layer[] layers) { | |
9 _layers = layers.dup; | |
10 } | |
11 | |
12 Rectangle bounds() const { | |
13 // Take the union of all layer bounds | |
14 Rectangle bounds = Rectangle.DEFAULT; | |
15 foreach (layer; _layers) { bounds = bounds | layer.bounds; } | |
16 assert(bounds.valid); | |
17 return bounds; | |
18 } | |
19 | |
80
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
20 void draw(in Rectangle screenDamage, scope Drawable screenDrawable, |
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
21 in Rectangle modelDamage, scope Drawable modelDrawable) { |
74 | 22 foreach(layer; _layers) { |
80
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
23 layer.draw(screenDamage, screenDrawable, modelDamage, modelDrawable); |
74 | 24 } |
25 } | |
26 | |
27 private { | |
28 Layer[] _layers; | |
29 } | |
30 } |