private void blur_ItemClick(object sender, ItemClickEventArgs e) { try { var bitmap = pictureEdit1.Image as Bitmap; if (bitmap == null) { return; } var size = bitmap.Size; using (var blinderDialog = new BlinderDialog(new Size(size.Width * 3 / 4, size.Height * 3 / 4))) { if (blinderDialog.ShowDialog() != DialogResult.OK) { return; } var blinderSize = blinderDialog.BlinderSize; using (var builder = new BlurBuilder(blinderSize)) pictureEdit1.Image = builder.Blur(bitmap); } } catch (Exception exception) { XtraMessageBox.Show(exception.Message); } }
private void blurToolStripMenuItem_Click(object sender, EventArgs e) { try { var bitmap = pictureEdit1.Image as Bitmap; if (bitmap == null) { throw new Exception("Нет изображения"); } var size = bitmap.Size; var blinderDialog = new BlinderDialog(new Size(size.Width / 2, size.Height / 2)); if (blinderDialog.ShowDialog() != DialogResult.OK) { return; } var filterSize = blinderDialog.BlinderSize; using (var builder = new BlurBuilder(filterSize)) { pictureEdit1.Image = builder.Blur(bitmap); } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void blur_ItemClick(object sender, ItemClickEventArgs e) { try { var bitmap = pictureEdit1.Image as Bitmap; if (bitmap == null) return; var size = bitmap.Size; using (var blinderDialog = new BlinderDialog(new Size(size.Width*3/4, size.Height*3/4))) { if (blinderDialog.ShowDialog() != DialogResult.OK) return; var blinderSize = blinderDialog.BlinderSize; using (var builder = new BlurBuilder(blinderSize)) pictureEdit1.Image = builder.Blur(bitmap); } } catch (Exception exception) { XtraMessageBox.Show(exception.Message); } }