Ejemplo n.º 1
0
        private void addLayer(Bitmap b, String name)
        {
            SharedSettings.flattenSelection();
            foreach (LayerItem layer in Layers)
            {
                layer.setActive(false);
            }

            LayerItem temp = new LayerItem(width, height, pf, name, ss);

            temp.Location   = new Point(0, yLayerLocation);
            yLayerLocation += temp.Height + 5;
            temp.setActive(true);
            temp.setOnClick(handleLayerItemClick);
            temp.setBitmap(b);

            Layers.Add(temp);
            pLayerDisplay.Controls.Add(Layers[Layers.Count - 1]);

            if (Layers.Count > 1)
            {
                bRemoveLayer.Enabled = true;
                bMoveDown.Enabled    = true;
                bMoveUp.Enabled      = true;
            }

            ss.setBitmapCurrentLayer(Layers[Layers.Count - 1].getBitmap());
        }
Ejemplo n.º 2
0
        public void addImportImage(Bitmap b)
        {
            SharedSettings.flattenSelection();
            foreach (LayerItem layer in Layers)
            {
                layer.setActive(false);
            }

            Bitmap bit = new Bitmap(SharedSettings.iCanvasWidth, SharedSettings.iCanvasHeight, PixelFormat.Format32bppArgb);

            Graphics.FromImage(bit).DrawImage(b, 0, 0);

            LayerItem temp = new LayerItem(width, height, pf, Layers.Count.ToString(), ss);

            temp.Location   = new Point(0, yLayerLocation);
            yLayerLocation += temp.Height + 5;
            temp.setActive(true);
            temp.setOnClick(handleLayerItemClick);
            temp.setBitmap((Bitmap)bit.Clone());
            Layers.Add(temp);
            pLayerDisplay.Controls.Add(Layers[Layers.Count - 1]);

            if (Layers.Count > 1)
            {
                bRemoveLayer.Enabled = true;
                bMoveDown.Enabled    = true;
                bMoveUp.Enabled      = true;
            }

            b.Dispose();
            bit.Dispose();

            redrawLayerItems();
        }