Ejemplo n.º 1
0
        //--------------------------------------------------------------------------------------
        private void tsbClean_Click(object sender, EventArgs e)
        {
            try
            {
                Bitmap lInBmp = pbBlackWhite.Image as Bitmap;
                if (lInBmp == null)
                {
                    MessageBox.Show("Нет картинки");
                    return;
                }
                byte[][] lMatrix = CBlackWhiteExplorer.BitmapToBinaryMatrix(lInBmp);
                if (cbClearColor.SelectedIndex < 3)
                {
                    CBlackWhiteExplorer.RemoveIsolatePoint(lMatrix, (byte)cbClearColor.SelectedIndex);
                }
                else if (cbClearColor.SelectedIndex == 3)
                {
                    CBlackWhiteExplorer.RemoveIsolatePoint(lMatrix, 0);
                    CBlackWhiteExplorer.RemoveIsolatePoint(lMatrix, 1);
                }
                else
                {
                    CBlackWhiteExplorer.RemoveIsolatePoint(lMatrix, 1);
                    CBlackWhiteExplorer.RemoveIsolatePoint(lMatrix, 0);
                }

                Bitmap lNewBmp = CBlackWhiteExplorer.BinaryMatrixToBitmap(lMatrix);
                pbAfterClean.Image = lNewBmp;
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
            }
        }