TEditXNA.Terraria.Textures.LoadTexture C# (CSharp) Method

LoadTexture() private method

private LoadTexture ( string path ) : Microsoft.Xna.Framework.Graphics.Texture2D
path string
return Microsoft.Xna.Framework.Graphics.Texture2D
        private Texture2D LoadTexture(string path)
        {
            try
            {
                var loadTexture = _cm.Load<Texture2D>(path);
                var pixels = new Color[loadTexture.Height * loadTexture.Width];
                loadTexture.GetData(pixels);
                for (int i = 0; i < pixels.Length; i++)
                {
                    if (pixels[i] == Color.Magenta || pixels[i] == ColorKey)
                    {
                        pixels[i] = Color.Transparent;
                    }
                }
                loadTexture.SetData(pixels);
                return loadTexture;
            }
            catch (Exception err)
            {
                ErrorLogging.Log(string.Format("Failed to load texture: {0}", path));
                ErrorLogging.Log(err.Message);
            }

            return _defaultTexture;
        }