Пример #1
0
        public void cutChar(Bitmap img)
        {
            Graphics gp    = Graphics.FromImage(img);
            Bitmap32 bmp32 = new Bitmap32(img);

            System.Drawing.Imaging.PixelFormat format = new System.Drawing.Imaging.PixelFormat();
            Point top, left, bot, right, prect;

            bmp32.LockBitmap();
            top   = bmp32.TopPoint();
            left  = bmp32.LeftPoint();
            bot   = bmp32.BotPoint();
            right = bmp32.RightPoint();
            //bmp32.Vector();
            int of = bmp32.Offset();

            for (int y = 0; y < img.Height; y++)
            {
                for (int x = 0; x < img.Width; x++)
                {
                    bmp32.DrawOutLine(x, y, of);
                }
            }
            bmp32.UnlockBitmap();
            prect = new Point(left.X, top.Y);
            Rectangle rect = new Rectangle(prect, new Size(right.X - left.X, bot.Y - top.Y));
            Bitmap    clone = img.Clone(rect, format);

            gp.DrawRectangle(new Pen(Color.Green), rect);
            picFitter.Image = clone;
        }