Esempio n. 1
0
    /// <summary>
    /// subtract all colors of this texture from textToSub
    /// </summary>
    /// <param name="texToSub"></param> GameTexture to subrtact
    public void subTexture(GameTexture texToSub)
    {
        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                GameColor color = texToSub.GetPixel(x, y);
                if (color.Equals(new GameColor("black")))
                {
                    blackLayers[x, y]--;
                }
                else if (!color.Equals(new GameColor("clear")))
                {
                    blackLayers[x, y] = 0;
                }

                if (blackLayers[x, y] > 0)
                {
                    totalColors[x, y] = new GameColor("black");
                }
                else if (blackLayers[x, y] < 0)
                {
                    totalColors[x, y] = new GameColor("clear");
                }
                else
                {
                    totalColors[x, y] = GetPixel(x, y).subtract(color);
                }
            }
        }
    }