public static SaveTextureData ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : string | ||
texture | Microsoft.Xna.Framework.Graphics.Texture2D | |
return | string |
public static string SaveTextureData(Texture2D texture)
{
var streamOut = new MemoryStream();
var width = texture.Width;
var height = texture.Height;
texture.SaveAsPng(streamOut, width, height);
return Convert.ToBase64String(streamOut.ToArray());
}