public void InitializeForm() { mBitmapManager = new BitmapManager(new Bitmap((Bitmap)PicMain.Image, new Size(PicMain.Width, PicMain.Height))); mAppState = new ApplicationState(); mAppState.Area = new CircleArea(new Point(-100, -100), 100); HistogramR.InitializeHistogram(Color.Red); HistogramG.InitializeHistogram(Color.Green); HistogramB.InitializeHistogram(Color.Blue); FilterPreviewR.InitializePreviewChart(); FilterPreviewG.InitializePreviewChart(); FilterPreviewB.InitializePreviewChart(); CustomFunctionFilter f = mBitmapManager.GetProperFilter(Filter.CustomFunction) as CustomFunctionFilter; FilterPreviewR.UpdateData(f.RawRedValues); FilterPreviewG.UpdateData(f.RawGreenValues); FilterPreviewB.UpdateData(f.RawBlueValues); ApplyFilterUI(); ApplyModeUI(); }
private void ModifyCustomFilter(object sender, EventArgs e) { CustomFunctionFilter f = mBitmapManager.GetProperFilter(Filter.CustomFunction) as CustomFunctionFilter; Control c = sender as Control; if (c.Name.Equals(FilterPreviewR.Name)) { f.RedValues = EditColorCurveForm.ShowForm(f.RedValues); FilterPreviewR.UpdateData(f.RawRedValues); } else if (c.Name.Equals(FilterPreviewG.Name)) { f.GreenValues = EditColorCurveForm.ShowForm(f.GreenValues); FilterPreviewG.UpdateData(f.RawGreenValues); } else if (c.Name.Equals(FilterPreviewB.Name)) { f.BlueValues = EditColorCurveForm.ShowForm(f.BlueValues); FilterPreviewB.UpdateData(f.RawBlueValues); } mBitmapManager.GenerateBitmap((int)Filter.CustomFunction); PicMain.Invalidate(); }