示例#1
0
 private void chbHorAni_CheckedChanged(object sender, EventArgs e)
 {
     if (((CheckBox)sender).Checked)
     {
         _xEffect.StartAnimation(
             im =>
         {
             if (rdbHorLay1.Checked)
             {
                 _xMathDisordered.BG1 = (Bitmap)im;
             }
             if (rdbHorLay2.Checked)
             {
                 _xMathDisordered.BG2 = (Bitmap)im;
             }
             if (rdbHorLay3.Checked)
             {
                 _xMathDisordered.BG3 = (Bitmap)im;
             }
             pcbHorMainPic.Image = _xMathDisordered.GetScreen();
         });
     }
     else
     {
         _xEffect.StopAnimation();
     }
 }
        private void UpdateColorPositions()
        {
            try
            {
                _posEffect.Clear();
                _posEffect.AddColorPosition(0, pcbPosColTop.BackColor);
                List <int> takenNumbers = new List <int>();

                foreach (DataGridViewRow row in dgvPosColors.Rows)
                {
                    int position = Convert.ToInt32(row.Cells["colPosition"].Value);
                    if (takenNumbers.Contains(position))
                    {
                        continue;
                    }
                    _posEffect.AddColorPosition(position, ColorTranslator.FromHtml((string)row.Cells["colColorString"].Value));
                    takenNumbers.Add(position);
                }
                _posEffect.AddColorPosition(EffectClasses.HDMA.Scanlines, pcbPosColBtm.BackColor);
                _posEffect.End();
                _posMath.FixedColor = _posEffect.EffectImage;
                pcbPosMainPic.Image = _posMath.GetScreen();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ups :<", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
 private void chbRelAni_CheckedChanged(object sender, EventArgs e)
 {
     if (((CheckBox)sender).Checked)
     {
         _relEffect.StartAnimation(
             im =>
         {
             if (cmbRelLay.SelectedIndex == 0)
             {
                 _relMathDisordered.BG1 = (Bitmap)im;
             }
             if (cmbRelLay.SelectedIndex == 1)
             {
                 _relMathDisordered.BG2 = (Bitmap)im;
             }
             if (cmbRelLay.SelectedIndex == 2)
             {
                 _relMathDisordered.BG3 = (Bitmap)im;
             }
             pcbRelMainPic.Image = _relMathDisordered.GetScreen();
         });
     }
     else
     {
         _relEffect.StopAnimation();
     }
 }
        private void ApplyCorrectRender()
        {
            if (cmbImgRnd.SelectedItem == null)
            {
                return;
            }

            float           percent    = trbImgBlkWhtSet.Value * 10;
            Bitmap          blackwhite = EffectClasses.BitmapEffects.FromColor(Color.White, 256, 224);
            ImageAttributes att        = new ImageAttributes();

            att.SetColorMatrix(new ColorMatrix(new float[][]
            {
                new float[] { 0, 0, 0, 0, 0 },
                new float[] { 0, 0, 0, 0, 0 },
                new float[] { 0, 0, 0, 0, 0 },
                new float[] { 0, 0, 0, 1, 0 },
                new float[] { 0, 0, 0, 0, 1 },
            }));

            switch ((RenderType)cmbImgRnd.SelectedItem)
            {
            case RenderType.Points:
                pnlImgPoi.Enabled = true;
                using (Graphics g = Graphics.FromImage(blackwhite))
                {
                    g.DrawImage(EffectClasses.BitmapEffects.Render(
                                    _imgEffect.Orignal, percent, lsbImgPoi.Items.Cast <Point>().ToArray()),
                                new Rectangle(new Point(0, 0), blackwhite.Size), 0, 0, blackwhite.Width, blackwhite.Height,
                                GraphicsUnit.Pixel, att);
                }
                break;

            case RenderType.Color:
                blackwhite = EffectClasses.BitmapEffects.BlackWhite(_imgEffect.Orignal, percent / 100);
                break;

            case RenderType.Transparent:
                using (Graphics g = Graphics.FromImage(blackwhite))
                {
                    g.DrawImage(_imgEffect.Orignal,
                                new Rectangle(new Point(0, 0), blackwhite.Size), 0, 0, blackwhite.Width, blackwhite.Height,
                                GraphicsUnit.Pixel, att);
                }
                break;
            }

            if (chbImgInv.Checked)
            {
                blackwhite = EffectClasses.BitmapEffects.Invert(blackwhite);
            }

            pcbImgWin.Image        = blackwhite;
            _imgEffect.EffectImage = blackwhite;
            lblImgNoEff.Visible    = !_imgEffect.CheckAndSplitMask(blackwhite, _imgMath);


            pcbImgMainPic.Image = _imgMath.GetScreen();
        }
        private void UpdateSingle()
        {
            EffectClasses.ColorHDMAValues col = 0;
            if (chbSngBlu.Checked)
            {
                col |= EffectClasses.ColorHDMAValues.Blue;
            }
            if (chbSngRed.Checked)
            {
                col |= EffectClasses.ColorHDMAValues.Red;
            }
            if (chbSngGrn.Checked)
            {
                col |= EffectClasses.ColorHDMAValues.Green;
            }
            _sngEffect.ColorEffect = col;
            _sngColl.Clear();

            int valTop = trbSngTop.Value;

            pcbSngTop.BackColor = Color.FromArgb(
                (chbSngRed.Checked ? valTop * 8 : 0),
                (chbSngGrn.Checked ? valTop * 8 : 0),
                (chbSngBlu.Checked ? valTop * 8 : 0));

            int valBtm = trbSngBtm.Value;

            pcbSngBtm.BackColor = Color.FromArgb(
                (chbSngRed.Checked ? valBtm * 8 : 0),
                (chbSngGrn.Checked ? valBtm * 8 : 0),
                (chbSngBlu.Checked ? valBtm * 8 : 0));

            if (chbSngCen.Checked)
            {
                _sngColl.Add(new EffectClasses.ColorPosition(0, (byte)(valTop * 8)));
                _sngColl.Add(new EffectClasses.ColorPosition(112, (byte)(valBtm * 8)));
                _sngColl.Add(new EffectClasses.ColorPosition(224, (byte)(valTop * 8)));
            }
            else
            {
                _sngColl.Add(new EffectClasses.ColorPosition(0, (byte)(valTop * 8)));
                _sngColl.Add(new EffectClasses.ColorPosition(224, (byte)(valBtm * 8)));
            }

            _sngEffect.ColorsPositions = _sngColl;
            _sngMath.FixedColor        = _sngEffect.EffectImage;
            pcbSngMainPic.Image        = _sngMath.GetScreen();
        }
        /// <summary>
        /// Sets the proper flags for the color math and updateds a PictureBox with the new screen.
        /// </summary>
        /// <param name="math">The ColorMath object which's flags should be set.</param>
        /// <param name="substract">Whether the subtraction flag should be set.</param>
        /// <param name="half">Whether the half flag should be set.</param>
        /// <param name="image">The picture box that will get the updated screen. If this is null, nothing will happen.</param>
        private void SetMath(EffectClasses.ColorMath math, bool substract, bool half, PictureBox image)
        {
            if (substract)
            {
                math.ColorMathDesignation |= EffectClasses.ColorMathMode.Substract;
            }
            else
            {
                math.ColorMathDesignation &= ~EffectClasses.ColorMathMode.Substract;
            }

            if (half)
            {
                math.ColorMathDesignation |= EffectClasses.ColorMathMode.Half;
            }
            else
            {
                math.ColorMathDesignation &= ~EffectClasses.ColorMathMode.Half;
            }

            if (image != null)
            {
                image.Image = math.GetScreen();
            }
        }
        private void UpdateScreen()
        {
            try
            {
                _colMath.FixedColor.Dispose();

                _colMath.BG1 = new Bitmap(pcbBG1.Image, Settings.DefaultSize);
                _colMath.BG2 = new Bitmap(pcbBG2.Image, Settings.DefaultSize);
                _colMath.BG3 = new Bitmap(pcbBG3.Image, Settings.DefaultSize);
                _colMath.BG4 = new Bitmap(pcbBG4.Image, Settings.DefaultSize);
                _colMath.OBJ = new Bitmap(pcbOBJ.Image, Settings.DefaultSize);
                _colMath.FixedColor
                    = EffectClasses.BitmapEffects.FromColor(
                          pcbCol.BackColor, Settings.DefaultSize);

                pcbMain.Image = _colMath.GetScreen();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Something went wrong.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#8
0
        public TestingGround()
        {
            InitializeComponent();

            EffectClasses.ColorMath math = new EffectClasses.ColorMath();
            math.WindowingMask1 = new Bitmap("left.png");
            math.WindowingMask2 = new Bitmap("right.png");
            math.Collection     = EffectClasses.BitmapCollection.Load(Properties.Resources.Default);

            math.MainScreenWindowMaskDesignation = EffectClasses.ScreenDesignation.BG1;
            math.Window1Enabled  = EffectClasses.WindowingLayers.BG1 | EffectClasses.WindowingLayers.BG2;
            math.Window1Inverted = EffectClasses.WindowingLayers.BG1;

            math.SubScreenWindowMaskDesignation = EffectClasses.ScreenDesignation.BG2;
            math.Window2Enabled = EffectClasses.WindowingLayers.BG2;
            math.Bg2MaskLogic   = EffectClasses.WindowMaskLogic.And;

            pictureBox1.Image = math.GetScreen();
        }
示例#9
0
 private void cmbTblScnSel_SelectedIndexChanged(object sender, EventArgs e)
 {
     LayerManager.AsignLayers(this, 1, _tblMath, sender);
     pcbTblMainPic.Image = EffectClasses.BitmapEffects.OverlapImages(_tblEffect.EffectImage, _tblMath.GetScreen());
 }
示例#10
0
        public void UpdateIndividual()
        {
            EffectClasses.HDMATable table = new EffectClasses.HDMATable();
            for (int i = 0; i < lsbIndEnt.Items.Count; i++)
            {
                table.Add((EffectClasses.HDMATableEntry)lsbIndEnt.Items[i]);
            }

            if (chbIndEnd.Checked && table.TotalScanlines < EffectClasses.HDMA.Scanlines)
            {
                table.Add(new EffectClasses.HDMATableEntry(EffectClasses.TableValueType.db, 1, 0xF));
            }

            _indEffect.FromTable(table);

            pcbIndMainPic.Image = EffectClasses.BitmapEffects.OverlapImages(_indEffect.EffectImage, _indMath.GetScreen());
        }
示例#11
0
 public void UpdateSimpleScreen()
 {
     pcbSmpMainPic.Image = EffectClasses.BitmapEffects.OverlapImages(
         _smpEffectTop.EffectImage, _smpEffectBtm.EffectImage, _smpMath.GetScreen());
 }
示例#12
0
 private void cmbWinScnSel_SelectedIndexChanged(object sender, EventArgs e)
 {
     LayerManager.AsignLayers(_windowingMath, sender);
     pcbWinMainPic.Image = _windowingMath.GetScreen();
 }
 private void cmbImgSrnSel_SelectedIndexChanged(object sender, EventArgs e)
 {
     LayerManager.AsignLayers(this, 1, _imgMath, sender, false);
     pcbImgMainPic.Image = _imgMath.GetScreen();
 }
 private void UpdateMultiScreen()
 {
     _mulMath.FixedColor = EffectClasses.BitmapEffects.MergeImages(
         _mulRed.EffectImage, _mulGreen.EffectImage, _mulBlue.EffectImage);
     pcbMulMainPic.Image = _mulMath.GetScreen();
 }