Example #1
0
        private Captcha rb_taskEffect(Bitmap bmp)
        {
            Captcha tmp = new Captcha(bmp);

            for (int i = 0; i < listBox_task.Items.Count; i++)
            {
                string[] cmd = listBox_task.Items[i].ToString().Split(' ');
                switch (cmd[0])
                {
                case "灰階化":
                    tmp.ConvertGrayByPixels(Int32.Parse(cmd[1]));
                    break;

                case "反轉顏色":
                    tmp.InvertColorByPixels();
                    break;

                case "顏色二值化":
                    tmp.ConvertGrayToBlackByPixels(Int32.Parse(cmd[1]));
                    break;

                case "亮度調整":
                    tmp.AdjustBrightness(Int32.Parse(cmd[1]));
                    break;
                }
            }
            return(tmp);
        }
Example #2
0
        private void rb_reflash()
        {
            if (pic_Captcha_result.Image == null)
            {
                pic_Captcha_effect.Image = null; return;
            }
            Captcha obj = new Captcha(new Bitmap(pic_Captcha_result.Image));

            if (rb_gray.Checked == true)
            {
                obj.ConvertGrayByPixels(comboBox_gray.SelectedIndex);
            }
            else if (rb_invert.Checked == true)
            {
                obj.InvertColorByPixels();
            }
            else if (rb_bit.Checked == true)
            {
                obj.ConvertGrayToBlackByPixels(Int32.Parse(textBox_bit.Text));
            }
            else if (rb_bright.Checked == true)
            {
                obj.AdjustBrightness(Int32.Parse(textBox_bright.Text));
            }
            pic_Captcha_effect.Image = obj.BmpSource;
        }