private void OnGaussianBlur(object sender, System.EventArgs e) { m_Undo = (System.Drawing.Bitmap)m_Bitmap.Clone(); if (BitmapFilter.GaussianBlur(m_Bitmap, 4)) { control.Invalidate(); } }
private void OnMeanRemoval(object sender, System.EventArgs e) { m_Undo = (System.Drawing.Bitmap)m_Bitmap.Clone(); if (BitmapFilter.MeanRemoval(m_Bitmap, 9)) { control.Invalidate(); } }
private void OnEdgeDetectQuick(object sender, System.EventArgs e) { m_Undo = (System.Drawing.Bitmap)m_Bitmap.Clone(); if (BitmapFilter.EdgeDetectQuick(m_Bitmap)) { control.Invalidate(); } }
private void OnEmbossLaplacian(object sender, System.EventArgs e) { m_Undo = (System.Drawing.Bitmap)m_Bitmap.Clone(); if (BitmapFilter.EmbossLaplacian(m_Bitmap)) { control.Invalidate(); } }
private void Filter_GrayScale(object sender, System.EventArgs e) { m_Undo = (System.Drawing.Bitmap)m_Bitmap.Clone(); if (BitmapFilter.GrayScale(m_Bitmap)) { control.Invalidate(); } }
private void OnSharpen(object sender, System.EventArgs e) { m_Undo = (System.Drawing.Bitmap)m_Bitmap.Clone(); if (BitmapFilter.Sharpen(m_Bitmap, 11)) { control.Invalidate(); } }
/// <summary> /// Bitmap Smooth /// </summary> /// <param name="b">Set the bitmap</param> /// <param name="nWeight">Set the weight of the bitmap.Default is 1</param> /// <returns></returns> public static bool Smooth(System.Drawing.Bitmap b, int nWeight /* default to 1 */) { ConvMatrix m = new ConvMatrix(); m.SetAll(1); m.Pixel = nWeight; m.Factor = nWeight + 8; return(BitmapFilter.Conv3x3(b, m)); }
/// <summary> /// Bitmap Mean Removal /// </summary> /// <param name="b">Set the bitmap</param> /// <param name="nWeight">Set the weight of the bitmap.Default is 9</param> /// <returns></returns> public static bool MeanRemoval(System.Drawing.Bitmap b, int nWeight /* default to 9*/) { ConvMatrix m = new ConvMatrix(); m.SetAll(-1); m.Pixel = nWeight; m.Factor = nWeight - 8; return(BitmapFilter.Conv3x3(b, m)); }
/// <summary> /// Bitmap EmbossLaplacian /// </summary> /// <param name="b">Set the bitmap</param> /// <returns></returns> public static bool EmbossLaplacian(System.Drawing.Bitmap b) { ConvMatrix m = new ConvMatrix(); m.SetAll(-1); m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 0; m.Pixel = 4; m.Offset = 127; return(BitmapFilter.Conv3x3(b, m)); }
/// <summary> /// Bitmap Sharpen /// </summary> /// <param name="b">Set the bitmap</param> /// <param name="nWeight">Set the weight of the bitmap.Default is 11</param> /// <returns></returns> public static bool Sharpen(System.Drawing.Bitmap b, int nWeight /* default to 11*/) { ConvMatrix m = new ConvMatrix(); m.SetAll(0); m.Pixel = nWeight; m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = -2; m.Factor = nWeight - 8; return(BitmapFilter.Conv3x3(b, m)); }
/// <summary> /// Gausian Blur function /// </summary> /// <param name="b">Set bitmap</param> /// <param name="nWeight">Set the weight of the bitmap which has a default value of 4 </param> /// <returns></returns> public static bool GaussianBlur(System.Drawing.Bitmap b, int nWeight /* default to 4*/) { ConvMatrix m = new ConvMatrix(); m.SetAll(1); m.Pixel = nWeight; m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 2; m.Factor = nWeight + 12; return(BitmapFilter.Conv3x3(b, m)); }
/// <summary> /// A function to blur a control /// </summary> /// <param name="control">Control to blur</param> /// <param name="pictureBox">Set a picture box</param> /// <param name="gausianWeight">Weight or size of the gausian blur</param> public static void BlurControl(Control control, PictureBox pictureBox, int gausianWeight) { System.Drawing.Bitmap bitmap = Screenshot.TakeSnapshot(control); BitmapFilter.GaussianBlur(bitmap, gausianWeight); //panel.Controls.Add(pictureBox); //control.FindForm().Controls.Add(pictureBox); //pictureBox.Location = control.Location; //pictureBox.Size = control.Size; pictureBox.Image = bitmap; pictureBox.Dock = DockStyle.Fill; pictureBox.BringToFront(); }
/// <summary> /// Bitmap Edge Detect Quick /// </summary> /// <param name="b">Set the bitmap</param> /// <returns></returns> public static bool EdgeDetectQuick(System.Drawing.Bitmap b) { ConvMatrix m = new ConvMatrix(); m.TopLeft = m.TopMid = m.TopRight = -1; m.MidLeft = m.Pixel = m.MidRight = 0; m.BottomLeft = m.BottomMid = m.BottomRight = 1; m.Offset = 127; return(BitmapFilter.Conv3x3(b, m)); }
private void OnFilterCustom(object sender, System.EventArgs e) { Form dlg = new Form(); if (DialogResult.OK == dlg.ShowDialog()) { m_Undo = (System.Drawing.Bitmap)m_Bitmap.Clone(); if (BitmapFilter.Conv3x3(m_Bitmap, Matrix)) { control.Invalidate(); } } }
private void Filter_Contrast(object sender, System.EventArgs e) { Form dlg = new Form(); int nValue = 0; if (DialogResult.OK == dlg.ShowDialog()) { m_Undo = (System.Drawing.Bitmap)m_Bitmap.Clone(); if (BitmapFilter.Contrast(m_Bitmap, (sbyte)nValue)) { control.Invalidate(); } } }
private void Filter_Color(object sender, System.EventArgs e) { Form dlg = new Form(); int red = 0, green = 0, blue = 0; if (DialogResult.OK == dlg.ShowDialog()) { m_Undo = (System.Drawing.Bitmap)m_Bitmap.Clone(); if (BitmapFilter.Color(m_Bitmap, red, green, blue)) { control.Invalidate(); } } }
public static System.Drawing.Bitmap BlurControl(System.Drawing.Bitmap bitmap, int gausianWeight) { BitmapFilter.GaussianBlur(bitmap, gausianWeight); return(bitmap); }