Esempio n. 1
0
        internal void AddLayer(LayerBase layer, Int32 zIndex)
        {
            if(layer == null)
                throw new ArgumentNullException();

            if(Layers.ContainsValue(layer))
                throw new ArgumentException("Duplicate layer added to DrawEngine2d.");

            SetRenderRequired();
            Layers.Add(zIndex, layer);
        }
Esempio n. 2
0
        private void CleanupLayers()
        {
            LayerBase[] layers = new LayerBase[Layers.Values.Count];
            Layers.Values.CopyTo(layers, 0);

            foreach(LayerBase layer in layers)
                layer.Dispose();
            Layers.Clear();

            Layers = null;
        }
Esempio n. 3
0
        public void RemoveLayer(LayerBase layer)
        {
            if(layer == null)
                throw new ArgumentNullException();

            if(!Layers.ContainsValue(layer))
                throw new ArgumentException("Unknown layer removal requested from DrawEngine2d.");

            SetRenderRequired();
            Int32 valueLocation = Layers.IndexOfValue(layer);
            Int32 zIndex = Layers.Keys[valueLocation];
            Layers.Remove(zIndex);
        }