示例#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());
        }
示例#2
0
 private void handleLayerItemClick(object obj, System.EventArgs args)
 {
     if (obj is LayerItem)
     {
         LayerItem layer = ((LayerItem)obj);
         if (!layer.isLayerActive())
         {
             SharedSettings.flattenSelection();
             foreach (LayerItem l in Layers)
             {
                 l.setActive(false);
             }
             layer.setActive(true);
             ss.setBitmapCurrentLayer(layer.getBitmap());
         }
         layer.Refresh();
     }
     else if (obj is PictureBox)
     {
         LayerItem layer = (LayerItem)((PictureBox)obj).Parent;
         if (!layer.isLayerActive())
         {
             SharedSettings.flattenSelection();
             foreach (LayerItem l in Layers)
             {
                 l.setActive(false);
                 l.Refresh();
             }
             layer.setActive(true);
         }
         layer.Refresh();
     }
     redrawLayerItems();
 }
示例#3
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();
        }