コード例 #1
0
ファイル: LayerView.cs プロジェクト: CoffeeRoll/Paint-Program
        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());
        }
コード例 #2
0
ファイル: LayerView.cs プロジェクト: CoffeeRoll/Paint-Program
        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();
        }