Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Bitmap     bm    = (Bitmap)pictureBox1.Image;
            BitmapData pdata = bm.LockBits(new Rectangle(0, 0, bm.Width, bm.Height),
                                           ImageLockMode.ReadWrite, bm.PixelFormat);

            try
            {
                IBitmapMagicWand  wand = new BitmapMagicWand();
                ScanLinePolygon[] polygons;
                //wand.Extract(pdata, new Point(497, 200),
                //    new byte[] { 227, 9, 0 },
                //    64,
                //    true,
                //    out bs);
                //wand.Extract(pdata, new Point(0, 0),
                //    new byte[] { 255, 212, 23 },
                //    64,
                //    false,
                //    out bs);
                //wand.Extract(pdata, new Point(6584, 5516),
                //    new byte[] { 23, 20, 15 },
                //    16,
                //    true,
                //    out bs);
                wand.FillColor(pdata, new Point(76, 98), 32, true, new byte[] { 0, 0, 255 });
            }
            finally
            {
                bm.UnlockBits(pdata);
            }
            pictureBox1.Refresh();
        }
Exemple #2
0
 private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         Bitmap     bm    = (Bitmap)pictureBox1.Image;
         BitmapData pdata = bm.LockBits(new Rectangle(0, 0, bm.Width, bm.Height), ImageLockMode.ReadWrite, bm.PixelFormat);
         try
         {
             using (IBitmapMagicWand wand = new BitmapMagicWand())
             {
                 Text = e.Location.ToString();
                 wand.FillColor(pdata, new Point(e.X, e.Y), 16, checkBox1.Checked, new byte[] { 0, 0, 255 });
                 //ScanLineSegment[] segs = wand.ExtractSnappedPixels(pdata, new Point(e.X, e.Y), 16, checkBox1.Checked);
             }
         }
         finally
         {
             bm.UnlockBits(pdata);
         }
         pictureBox1.Refresh();
     }
 }