Example #1
0
        public void AlphaCrop(Color c)
        {
            AlphaCrop alphaCrop = new AlphaCrop(c);

            for (int i = 0; i < listBitmap.Count; i++)
            {
                Bitmap    item      = listBitmap[i];
                Rectangle rect      = alphaCrop.DoCrop(item);
                Bitmap    newBitmap = new Bitmap(rect.Width, rect.Height);
                Graphics  g         = Graphics.FromImage(newBitmap);
                g.DrawImage(item,
                            new Rectangle(0, 0, newBitmap.Width, newBitmap.Height),
                            rect,
                            GraphicsUnit.Pixel
                            );
                listBitmap[i].Dispose();
                listBitmap[i] = newBitmap;
                listOffset[i].Offset(new Point(rect.X, rect.Y));
            }
        }
Example #2
0
 public void AlphaCrop(Color c)
 {
     AlphaCrop alphaCrop = new AlphaCrop(c);
     for (int i = 0; i < listBitmap.Count; i++)
     {
         Bitmap item = listBitmap[i];
         Rectangle rect = alphaCrop.DoCrop(item);
         Bitmap newBitmap = new Bitmap(rect.Width, rect.Height);
         Graphics g = Graphics.FromImage(newBitmap);
         g.DrawImage(item,
             new Rectangle(0, 0, newBitmap.Width, newBitmap.Height),
             rect,
             GraphicsUnit.Pixel
             );
         listBitmap[i].Dispose();
         listBitmap[i] = newBitmap;
         listOffset[i].Offset(new Point(rect.X, rect.Y));
     }
 }