Ejemplo n.º 1
0
        /// <summary>
        /// Apply all images to a Pixelated filter
        /// </summary>
        private void PixelateAll_Click(object sender, EventArgs e)
        {
            #region Reset and Undo Properties

            btnUndo.Enabled = true;
            btnReset.Enabled = true;

            _listFramesUndo.Clear();
            _listFramesUndo = new List<Bitmap>(_listFramesPrivate);

            _listDelayUndo.Clear();
            _listDelayUndo = new List<int>(_listDelayPrivate);

            #endregion

            ValuePicker valuePicker = new ValuePicker(100, 2, Resources.Msg_PixelSize);

            if (valuePicker.ShowDialog() == DialogResult.OK)
            {
                this.Cursor = Cursors.WaitCursor;
                _listFramesPrivate = ImageUtil.Pixelate(_listFramesPrivate,
                    new Rectangle(0, 0, pictureBitmap.Image.Width, pictureBitmap.Image.Height), valuePicker.Value);
                pictureBitmap.Image = _listFramesPrivate[trackBar.Value];
                this.Cursor = Cursors.Default;
            }

            valuePicker.Dispose();
            btnReset.Enabled = true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Apply all images to a blur filter
        /// </summary>
        private void BlurAll_Click(object sender, EventArgs e)
        {
            #region Reset and Undo Properties

            btnUndo.Enabled = true;
            btnReset.Enabled = true;

            _listFramesUndo.Clear();
            _listFramesUndo = new List<Bitmap>(_listFramesPrivate);

            _listDelayUndo.Clear();
            _listDelayUndo = new List<int>(_listDelayPrivate);

            #endregion

            ValuePicker valuePicker = new ValuePicker(5, 1, Resources.Msg_BlurIntense);

            if (valuePicker.ShowDialog() == DialogResult.OK)
            {
                this.Cursor = Cursors.WaitCursor;

                //This thing down here didn't make any difference. Still hangs.
                // http://www.codeproject.com/Articles/45787/Easy-asynchronous-operations-with-AsyncVar Oh, I see now, this thing it's good only with multiple actions.
                var asyncVar =
                    new AsyncVar<List<Bitmap>>(
                        () =>
                            ImageUtil.Blur(_listFramesPrivate,
                                new Rectangle(0, 0, pictureBitmap.Image.Width, pictureBitmap.Image.Height),
                                valuePicker.Value));
                //_listFramesPrivate = ImageUtil.Blur(_listFramesPrivate, new Rectangle(0, 0, pictureBitmap.Image.Width, pictureBitmap.Image.Height), valuePicker.Value);

                _listFramesPrivate = new List<Bitmap>(asyncVar.Value);

                pictureBitmap.Image = _listFramesPrivate[trackBar.Value];
                this.Cursor = Cursors.Default;
            }

            valuePicker.Dispose();
            btnReset.Enabled = true;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Apply selected image to a blur filter
        /// </summary>
        private void BlurOne_Click(object sender, EventArgs e)
        {
            #region Reset and Undo Properties

            btnUndo.Enabled = true;
            btnReset.Enabled = true;

            _listFramesUndo.Clear();
            _listFramesUndo = new List<Bitmap>(_listFramesPrivate);

            _listDelayUndo.Clear();
            _listDelayUndo = new List<int>(_listDelayPrivate);

            #endregion

            ValuePicker valuePicker = new ValuePicker(5, 1, Resources.Msg_BlurIntense);

            if (valuePicker.ShowDialog() == DialogResult.OK)
            {

                _listFramesPrivate[trackBar.Value] = ImageUtil.Blur((Bitmap)pictureBitmap.Image,
                    new Rectangle(0, 0, pictureBitmap.Image.Width, pictureBitmap.Image.Height), valuePicker.Value);

                pictureBitmap.Image = _listFramesPrivate[trackBar.Value];
            }
            valuePicker.Dispose();
            btnReset.Enabled = true;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Apply selected image to a pixelated filter
        /// </summary>
        private void PixelateOne_Click(object sender, EventArgs e)
        {
            #region Reset and Undo Properties

            btnUndo.Enabled = true;
            btnReset.Enabled = true;

            _listFramesUndo.Clear();
            _listFramesUndo = new List<Bitmap>(_listFramesPrivate);

            _listDelayUndo.Clear();
            _listDelayUndo = new List<int>(_listDelayPrivate);

            #endregion

            //User first need to choose the intensity of the pixelate
            ValuePicker valuePicker = new ValuePicker(100, 2, Resources.Msg_PixelSize);

            if (valuePicker.ShowDialog() == DialogResult.OK) //Should I keep everything inside here? (the undo and reset stuff)
            {
                _listFramesPrivate[trackBar.Value] = ImageUtil.Pixelate((Bitmap)pictureBitmap.Image, new Rectangle(0, 0, pictureBitmap.Image.Width, pictureBitmap.Image.Height), valuePicker.Value);
                pictureBitmap.Image = _listFramesPrivate[trackBar.Value];
            }

            valuePicker.Dispose();
            btnReset.Enabled = true;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Apply selected image to a blur filter
        /// </summary>
        private void Blur_Click(object sender, EventArgs e)
        {
            const string filterLabel = "Blur filter";

            var valuePicker = new ValuePicker(5, 1, Resources.Msg_BlurIntense);

            if (valuePicker.ShowDialog() == DialogResult.OK)
            {
                this.Cursor = Cursors.WaitCursor;
                panelEdit.Enabled = false;
                panelBottom.Enabled = false;

                filterDel = ApplyActionToFrames;
                filterDel.BeginInvoke(filterLabel, ActionEnum.Blur, valuePicker.Value, null, CallBackFilter, null);
            }

            valuePicker.Dispose();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Apply selected image to a pixelated filter
        /// </summary>
        private void Pixelate_Click(object sender, EventArgs e)
        {
            const string filterLabel = "Pixelate filter";

            //User first need to choose the intensity of the pixelate
            var valuePicker = new ValuePicker(100, 2, Resources.Msg_PixelSize);

            if (valuePicker.ShowDialog() == DialogResult.OK)
            {
                this.Cursor = Cursors.WaitCursor;
                panelEdit.Enabled = false;
                panelBottom.Enabled = false;

                filterDel = ApplyActionToFrames;
                filterDel.BeginInvoke(filterLabel, ActionEnum.Pixelate, valuePicker.Value, null, CallBackFilter, null);
            }

            valuePicker.Dispose();
        }
Ejemplo n.º 7
0
        private void con_changeSpeed_Click(object sender, EventArgs e)
        {
            var valuePicker = new ValuePicker(Resources.MsgSelectSpeed, 500, 15, Resources.Label_Normal, 100);
            valuePicker.Lower = Resources.Label_Slower;
            valuePicker.Greater = Resources.Label_Faster;
            valuePicker.Normal = Resources.Label_Normal;

            if (valuePicker.ShowDialog(this) == DialogResult.OK)
            {
                this.Cursor = Cursors.WaitCursor;

                if (valuePicker.Value != 0)
                {
                    float speed = 1;

                    //TODO: Remove range.
                    speed = valuePicker.Value / 100F;

                    ApplyActionToFrames("Slo-Motion", ActionEnum.Speed, speed);
                    GC.Collect();
                }

                this.Cursor = Cursors.Default;
            }
        }