public static Texture2D FixAlpha(Texture2D file)
        {
            RenderTarget2D result = null;

            //Setup a render target to hold our final texture which will have premulitplied alpha values
            result = new RenderTarget2D(CakeEngine.staticDevice, file.Width, file.Height);

            RenderManager.SetTarget(result);
            RenderManager.ClearTarget(Color.Black);

            //Multiply each color by the source alpha, and write in just the color values into the final texture
            //TODO: blend states should be constracted once.
            BlendState blendColor = new BlendState
            {
                ColorWriteChannels = ColorWriteChannels.Red | ColorWriteChannels.Green | ColorWriteChannels.Blue,

                AlphaDestinationBlend = Blend.Zero,
                ColorDestinationBlend = Blend.Zero,

                AlphaSourceBlend = Blend.SourceAlpha,
                ColorSourceBlend = Blend.SourceAlpha
            };

            SpriteBatch spriteBatch = new SpriteBatch(CakeEngine.staticDevice);

            spriteBatch.Begin(SpriteSortMode.Immediate, blendColor);
            spriteBatch.Draw(file, file.Bounds, Color.White);
            spriteBatch.End();

            //Now copy over the alpha values from the PNG source texture to the final one, without multiplying them
            BlendState blendAlpha = new BlendState
            {
                ColorWriteChannels = ColorWriteChannels.Alpha,

                AlphaDestinationBlend = Blend.Zero,
                ColorDestinationBlend = Blend.Zero,

                AlphaSourceBlend = Blend.One,
                ColorSourceBlend = Blend.One
            };

            spriteBatch.Begin(SpriteSortMode.Immediate, blendAlpha);
            spriteBatch.Draw(file, file.Bounds, Color.White);
            spriteBatch.End();

            //Release the GPU back to drawing to the screen
            RenderManager.SetTarget(null);

            return(result as Texture2D);
        }