Beispiel #1
0
        void makeTranBg()
        {
            Color[] c = new Color[Tex.Width * Tex.Height]; //making a new color array
            Tex.GetData <Color>(c);                        //inserting the color from the texture into the color array
            Color back = c[0];                             //declaring the first pixel of the texture to be the background color

            for (int i = 0; i < c.Length; i++)             // for every spot in the color array
            {
                if (c[i] == back)                          // if the color is the background color
                {
                    c[i] = Color.Transparent;              // change the color to transparent
                }
            }
            Tex.SetData <Color>(c); //sending all the pixels back into the texture after making the background transparent
        }
Beispiel #2
0
        void MakeBgTrans()
        {
            //This Method Tekes the whole Texture and turns the background color into clear pixels.
            Color[] c = new Color[Tex.Width * Tex.Height];
            Tex.GetData <Color>(c);
            Color trans = c[0];

            for (int i = 0; i < c.Length; i++)
            {
                if (c[i] == trans)
                {
                    c[i] = Color.Transparent;
                }
            }

            //Putting back the clear version of the texture into the Texture.
            Tex.SetData <Color>(c);
        }