Example #1
0
        private void ChangeParameter(object sender, EventArgs e)
        {
            if (mAppState.Filter == Filter.BrightnessChange &&
                InputForm.DisplayInputFormInt(-100, 100, mBitmapManager.BrightnessValue, out int result))
            {
                mBitmapManager.BrightnessValue = result;
                mAppState.Filter = Filter.BrightnessChange;
            }

            if (mAppState.Filter == Filter.GammaCorrection &&
                InputForm.DisplayInputFormDouble(0.1, 3.0, mBitmapManager.GammaValue, out double result1))
            {
                mBitmapManager.GammaValue = result1;
                mAppState.Filter          = Filter.GammaCorrection;
            }

            if (mAppState.Filter == Filter.ConstrastEnhancement &&
                InputForm.DisplayInputFormDouble(0.1, 50.0, mBitmapManager.ContrastValue, out double result2))
            {
                mBitmapManager.ContrastValue = result2;
                mAppState.Filter             = Filter.ConstrastEnhancement;
            }

            if (mAppState.Filter == Filter.SingleComponent)
            {
                int sc = (int)mBitmapManager.SingleComponentValue;
                mBitmapManager.SingleComponentValue = (SingleComponent)((sc + 1) % 3);
            }

            PicMain.Invalidate();
            ApplyFilterUI();
        }
Example #2
0
 private void PicMain_MouseMove(object sender, MouseEventArgs e)
 {
     if (mAppState.CurrentArea != Area.WholeImage)
     {
         mAppState.Area.Center = new Point(e.X, e.Y);
         PicMain.Invalidate();
         UpdateHistograms();
     }
 }
 private void PicMain_MouseUp(object sender, MouseEventArgs e)
 {
     if (ModifierKeys.HasFlag(Keys.Control))
     {
         return;
     }
     DeselectVertices();
     PicMain.Invalidate();
 }
        private void PicMain_MouseMove(object sender, MouseEventArgs e)
        {
            if (mCurrentVertex != null)
            {
                mCurrentVertex.X += e.X - mPrevCursorX;
                mCurrentVertex.Y -= e.Y - mPrevCursorY;
            }

            mPrevCursorX = e.X;
            mPrevCursorY = e.Y;
            PicMain.Invalidate();
        }
        private void PicMain_MouseMove(object sender, MouseEventArgs e)
        {
            if (ModifierKeys.HasFlag(Keys.Control))
            {
                return;
            }
            int dy = e.Y - mPrevCursorY;

            foreach (Vertex vertex in mSelectedVertices)
            {
                if (vertex.Y - dy >= 0 && vertex.Y - dy <= 255)
                {
                    vertex.Y -= dy;
                }
            }
            mPrevCursorY = e.Y;

            PicMain.Invalidate();
        }
Example #6
0
        private void ChangeModeClick(object sender, EventArgs e)
        {
            ToolStripMenuItem tsmi = sender as ToolStripMenuItem;

            if (tsmi.Name.Equals(TItemModeCircle.Name))
            {
                mAppState.CurrentArea = Area.Circle;
            }
            else if (tsmi.Name.Equals(TItemModeCustomPolygon.Name))
            {
                mAppState.CurrentArea = Area.Polygon;
            }
            else if (tsmi.Name.Equals(TItemModeWholeImage.Name))
            {
                mAppState.CurrentArea = Area.WholeImage;
                UpdateHistograms();
                PicMain.Invalidate();
            }
            ApplyModeUI();
        }
        private void PicMain_MouseDown(object sender, MouseEventArgs e)
        {
            if (!ModifierKeys.HasFlag(Keys.Control))
            {
                return;
            }

            int vertexId = mGraph.LocateVertex(e.X - X_AXIS_OFFSET, mGraphArea.Bottom - e.Y);

            if (vertexId != -1)
            {
                SelectVertex(mGraph.GetVertex(vertexId));
            }
            else
            {
                DeselectVertices();
            }
            mPrevCursorY = e.Y;
            PicMain.Invalidate();
        }
Example #8
0
        private void ChangeFilter(object sender, EventArgs e)
        {
            Control rb = sender as Control;

            if (rb.Name.Equals("RbBrightnessChange"))
            {
                mAppState.Filter = Filter.BrightnessChange;
            }
            else if (rb.Name.Equals("RbContrastEnhancement"))
            {
                mAppState.Filter = Filter.ConstrastEnhancement;
            }
            else if (rb.Name.Equals("RbCustomFunction"))
            {
                mAppState.Filter = Filter.CustomFunction;
            }
            else if (rb.Name.Equals("RbGammaCorrection"))
            {
                mAppState.Filter = Filter.GammaCorrection;
            }
            else if (rb.Name.Equals("RbGrayscale"))
            {
                mAppState.Filter = Filter.Grayscale;
            }
            else if (rb.Name.Equals("RbNegative"))
            {
                mAppState.Filter = Filter.Negative;
            }
            else if (rb.Name.Equals("RbNoFilter"))
            {
                mAppState.Filter = Filter.No;
            }
            else if (rb.Name.Equals("RbSingleComponent"))
            {
                mAppState.Filter = Filter.SingleComponent;
            }

            PicMain.Invalidate();
            ApplyFilterUI();
        }
Example #9
0
        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();
        }
Example #10
0
        private void PicMain_MouseWheel(object sender, MouseEventArgs e)
        {
            int currentValue = (int)(mAppState.Filter);
            int allValues    = Enum.GetNames(typeof(Filter)).Length;

            if (e.Delta > 0)
            {
                if (currentValue == 0)
                {
                    mAppState.Filter = (Filter)(allValues - 1);
                }
                else
                {
                    mAppState.Filter = (Filter)((currentValue - 1) % allValues);
                }
            }
            else
            {
                mAppState.Filter = (Filter)((currentValue + 1) % allValues);
            }
            ApplyFilterUI();
            PicMain.Invalidate();
            UpdateHistograms();
        }
 private void EditColorCurveForm_MouseDown(object sender, MouseEventArgs e)
 {
     DeselectVertices();
     PicMain.Invalidate();
 }