Mercurial > projects > doodle
diff doodle/dia/layer_stack.d @ 74:c03ed75c0f8e
Icky
author | "David Bryant <bagnose@gmail.com>" |
---|---|
date | Sun, 15 Aug 2010 01:11:58 +0930 |
parents | |
children | b759414d2b72 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doodle/dia/layer_stack.d Sun Aug 15 01:11:58 2010 +0930 @@ -0,0 +1,30 @@ +module doodle.dia.layer_stack; + +public { + import doodle.dia.icanvas; +} + +final class LayerStack { + this(in Layer[] layers) { + _layers = layers.dup; + } + + Rectangle bounds() const { + // Take the union of all layer bounds + Rectangle bounds = Rectangle.DEFAULT; + foreach (layer; _layers) { bounds = bounds | layer.bounds; } + assert(bounds.valid); + return bounds; + } + + void draw(in Rectangle pixelDamage, scope Context pixelCr, + in Rectangle modelDamage, scope Context modelCr) { + foreach(layer; _layers) { + layer.draw(pixelDamage, pixelCr, modelDamage, modelCr); + } + } + + private { + Layer[] _layers; + } +}