AssetTexture assetTexture = e.getAssetTexture();
if (state == TextureRequestState.Finished)
{
try{
ManagedImage mi = OpenJPEGFactory.getIntance().DecodeToImage(assetTexture.AssetData);
if (removeAlpha)
{
if ((ImageChannels.and(mi.Channels, ManagedImage.ImageChannels.Alpha)) != 0)
{
mi.ConvertChannels(ImageChannels.get(ImageChannels.and(mi.Channels, ~ManagedImage.ImageChannels.Alpha.getIndex())));
}
}
byte[] tgaData = mi.ExportTGA();
texDownloadResult[0] = LoadTGAClass.LoadTGA(new ByteArrayInputStream(tgaData));
client.assets.Cache.compressAndSaveImageToCache(textureID, tgaData, ImageChannels.and(mi.Channels, ManagedImage.ImageChannels.Alpha) != 0, false, false);
}
catch(Exception ex)