Example #1
0
        private void pasteImage(bool over)
        {
            Bitmap pastedBitmap = BitmapStuff.GetBitmapFromClipboard(new Size(32, 32));

            if (pastedBitmap != null) //no errors, everything about the header looks right
            {
                MakeEntireImageUndoable();
                var clipboard = BitmapStuff.BitmapToByteArray(pastedBitmap);
                if (over)
                {
                    for (int i = 0; i < 32 * 32; ++i)
                    {
                        if (clipboard[i] > 1)
                        {
                            Image[i] = clipboard[i];
                        }
                    }
                }
                else //under
                {
                    for (int i = 0; i < 32 * 32; ++i)
                    {
                        if (Image[i] == 0)
                        {
                            Image[i] = clipboard[i];
                        }
                    }
                }
                DrawImage();
            }
        }
Example #2
0
 private void copyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (EditingImage)
     {
         Bitmap bitmap = new Bitmap(32, 32, PixelFormat.Format8bppIndexed);
         originalPalette.Palette.Apply(bitmap);
         BitmapStuff.ByteArrayToBitmap(Image, bitmap, true);
         BitmapStuff.CopyBitmapToClipboard(bitmap);
     }
     else
     {
         ClipboardMask = Image.Clone() as byte[]; //a lot simpler but limited to this particular application
         pasteToolStripMenuItem.Enabled = true;
     }
 }