private void RefreshImage() { PreprocessingSettings.InvertColors = checkBoxInvertColors.Checked; PreprocessingSettings.BinaryImageCompareThreshold = (int)numericUpDownThreshold.Value; PreprocessingSettings.ScalingPercent = (int)numericUpDownScaling.Value; pictureBox1.Image?.Dispose(); var n = new NikseBitmap(_source); if (PreprocessingSettings.InvertColors) { n.InvertColors(); } n.MakeTwoColor((int)numericUpDownThreshold.Value, Color.White, Color.Black); if (PreprocessingSettings.ScalingPercent > 100) { var bTemp = n.GetBitmap(); var f = PreprocessingSettings.ScalingPercent / 100.0; var b = ResizeBitmap(bTemp, (int)Math.Round(bTemp.Width * f), (int)Math.Round(bTemp.Height * f)); bTemp.Dispose(); pictureBox1.Image = b; return; } pictureBox1.Image = n.GetBitmap(); }
private void RefreshImage() { if (_loading) { return; } PreprocessingSettings.InvertColors = checkBoxInvertColors.Checked; PreprocessingSettings.YellowToWhite = checkBoxYellowToWhite.Enabled && checkBoxYellowToWhite.Checked; PreprocessingSettings.ColorToWhite = buttonColorToWhite.Enabled ? panelColorToWhite.BackColor : Color.Transparent; PreprocessingSettings.ColorToRemove = buttonColorToRemove.Enabled ? panelColorToRemove.BackColor : Color.Transparent; PreprocessingSettings.CropTransparentColors = checkBoxCropTransparent.Checked; PreprocessingSettings.BinaryImageCompareThreshold = (int)numericUpDownThreshold.Value; pictureBox1.Image?.Dispose(); var n = new NikseBitmap(_source); if (PreprocessingSettings.CropTransparentColors) { n.CropSidesAndBottom(2, Color.Transparent, true); n.CropSidesAndBottom(2, Color.FromArgb(0, 0, 0, 0), true); n.CropTop(2, Color.Transparent); n.CropTop(2, Color.FromArgb(0, 0, 0, 0)); } if (PreprocessingSettings.InvertColors) { n.InvertColors(); } if (PreprocessingSettings.YellowToWhite) { n.ReplaceYellowWithWhite(); } if (panelColorToWhite.BackColor != Color.Transparent) { n.ReplaceColor(panelColorToWhite.BackColor.A, panelColorToWhite.BackColor.R, panelColorToWhite.BackColor.G, panelColorToWhite.BackColor.B, 255, 255, 255, 255); } if (panelColorToRemove.BackColor != Color.Transparent) { n.ReplaceColor(panelColorToRemove.BackColor.A, panelColorToRemove.BackColor.R, panelColorToRemove.BackColor.G, panelColorToRemove.BackColor.B, Color.Transparent.A, Color.Transparent.R, Color.Transparent.G, Color.Transparent.B); } if (_isBinaryImageCompare) { n.MakeTwoColor((int)numericUpDownThreshold.Value); } pictureBox1.Image = n.GetBitmap(); }
private void RefreshImage() { PreprocessingSettings.InvertColors = checkBoxInvertColors.Checked; PreprocessingSettings.BinaryImageCompareThreshold = (int)numericUpDownThreshold.Value; pictureBox1.Image?.Dispose(); var n = new NikseBitmap(_source); if (PreprocessingSettings.InvertColors) { n.InvertColors(); } n.MakeTwoColor((int)numericUpDownThreshold.Value, Color.White, Color.Black); pictureBox1.Image = n.GetBitmap(); }
private void RefreshImage() { if (_loading) { return; } PreprocessingSettings.InvertColors = checkBoxInvertColors.Checked; PreprocessingSettings.BinaryImageCompareThreshold = (int)numericUpDownThreshold.Value; PreprocessingSettings.ScalingPercent = (int)numericUpDownScaling.Value; PreprocessingSettings.CropTransparentColors = checkBoxCropTransparent.Checked; pictureBox1.Image?.Dispose(); var n = new NikseBitmap(_source); if (PreprocessingSettings.CropTransparentColors) { n.CropSidesAndBottom(2, Color.Transparent, true); n.CropSidesAndBottom(2, Color.FromArgb(0, 0, 0, 0), true); n.CropTop(2, Color.Transparent); n.CropTop(2, Color.FromArgb(0, 0, 0, 0)); } if (PreprocessingSettings.InvertColors) { n.InvertColors(); n.MakeTwoColor((int)numericUpDownThreshold.Value, Color.Black, Color.White); } else { n.MakeTwoColor((int)numericUpDownThreshold.Value, Color.White, Color.Black); } if (PreprocessingSettings.ScalingPercent > 100) { var bTemp = n.GetBitmap(); var f = PreprocessingSettings.ScalingPercent / 100.0; var b = ResizeBitmap(bTemp, (int)Math.Round(bTemp.Width * f), (int)Math.Round(bTemp.Height * f)); bTemp.Dispose(); pictureBox1.Image = b; return; } pictureBox1.Image = n.GetBitmap(); }