/// <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();
            }
        }
        /// <summary>
        /// Asign the Bitmaps to a ColorMath object from a ComboBox.
        /// </summary>
        /// <param name="tab">The gui calling this</param>
        /// <param name="layer"></param>Which layer the screenshot will be used on.
        /// <param name="math">The ColorMath that will get the images assigned to it.</param>
        /// <param name="Selector">The ComboBox containing BitmapCollection objects.</param>
        /// <param name="setColor"><c>True</c> will overwrite the FixedColor property of the ColorMath with the one from the BitmapCollection.</param>
        public static void AsignLayers(ITab tab, int layer, EffectClasses.ColorMath math, object Selector, bool setColor)
        {
            //remove image of current tab from screenshot collection.
            int index   = tab.GetTabControl().SelectedIndex;
            var tabAsSS = tab as IScreenshotUser;

            if (tabAsSS != null)
            {
                if (tabAsSS.ScreenshotsImages[index] != null)
                {
                    tabAsSS.ScreenshotsImages[index].Dispose();
                }
                tabAsSS.ScreenshotsImages[index] = null;
            }

            //The first Object is the option to use a screenshot.
            if (((ComboBox)Selector).SelectedIndex == 0)
            {
                if (tab is IScreenshotUser)
                {
                    var screenshot = FetchScreenshot();
                    if (screenshot == null)
                    {
                        ((ComboBox)Selector).SelectedIndex = 1;
                    }
                    else
                    {
                        tabAsSS.ScreenshotsImages[index] = screenshot;
                        math.OBJ = new Bitmap(256, 224);

                        math.BG1 = (layer == 1) ? screenshot : new Bitmap(256, 224);
                        math.BG2 = (layer == 2) ? screenshot : new Bitmap(256, 224);
                        math.BG3 = (layer == 3) ? screenshot : new Bitmap(256, 224);
                        math.BG4 = (layer == 4) ? screenshot : new Bitmap(256, 224);
                    }
                }
                else
                {
                    MessageBox.Show("This tab is not supporting the use of screenshots.", "Not Implemented", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ((ComboBox)Selector).SelectedIndex = 1;
                }
            }
            else
            {
                EffectClasses.BitmapCollection bc = (EffectClasses.BitmapCollection)((ComboBox)Selector).SelectedItem;
                math.Collection = bc;
                if (setColor)
                {
                    if (bc.FixedColor == null)
                    {
                        bc.FixedColor = Color.Transparent;
                    }
                    math.FixedColor = EffectClasses.BitmapEffects.FromColor(bc.FixedColor, bc.BG1.Size);
                }
            }
        }
        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();
        }
        public static void AsignLayers(EffectClasses.ColorMath Math, object Selector, bool setColor)
        {
            //The first Object is the option to use a screenshot.
            if (((ComboBox)Selector).SelectedIndex == 0)
            {
                MessageBox.Show("This feature is currently not available.", "Not Implemented", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ((ComboBox)Selector).SelectedIndex = 1;
            }

            EffectClasses.BitmapCollection bc = (EffectClasses.BitmapCollection)((ComboBox)Selector).SelectedItem;
            Math.Collection = bc;
            if (setColor)
            {
                if (bc.FixedColor == null)
                {
                    bc.FixedColor = Color.Transparent;
                }
                Math.FixedColor = EffectClasses.BitmapEffects.FromColor(bc.FixedColor, bc.BG1.Size);
            }
        }
 /// <summary>
 /// Asign the Bitmaps to a ColorMath object from a ComboBox.
 /// </summary>
 /// <param name="tab">The gui calling this method</param>
 /// <param name="Math">The ColorMath that will get the images assigned to it.</param>
 /// <param name="Selector">The ComboBox containing BitmapCollection objects.</param>
 public static void AsignLayers(ITab tab, int layer, EffectClasses.ColorMath Math, object Selector)
 {
     AsignLayers(tab, layer, Math, Selector, true);
 }
 public static void AsignLayers(EffectClasses.ColorMath Math, object Selector)
 {
     AsignLayers(Math, Selector, true);
 }