public static Texture2D StoreTexture(ulong id, ContentResource assetData, bool mask, bool cacheOnDisk)
{
/**
* This may not be the right way to get the texture to load as ARGB but it works :S
*/
Texture2D texture = null;
using (var stream = new MemoryStream(assetData.Data, false))
{
var isCached = assetData.FromCache;
if (mask && !isCached)
{
//var textureParams = Texture2D.GetCreationParameters(GameFacade.GraphicsDevice, stream);
//textureParams.Format = SurfaceFormat.Color;
stream.Seek(0, SeekOrigin.Begin);
texture = ImageLoader.FromStream(GameFacade.GraphicsDevice, stream); //, textureParams);
//TextureUtils.ManualTextureMaskSingleThreaded(ref texture, MASK_COLORS);
}
else
{
texture = ImageLoader.FromStream(GameFacade.GraphicsDevice, stream);
}
UI_TEXTURE_CACHE.Add(id, texture);
return texture;
}
}