我需要将 jpeg 图像导入带有相关元数据的 WP7/XNA 应用程序。管理这些图像的程序导出到带有 jpg 文件的编码字节 [] 的 XML 文件。
我编写了一个自定义导入器/处理器,它成功地将重新序列化的对象导入到我的 XNA 项目中。
我的问题是,鉴于 jpg 的字节 [],将其转换回 Texture2D 的最佳方法是什么。
// 'Standard' method for importing image
Texture2D texture1 = Content.Load<Texture2D>("artwork"); // Uses the standard Content processor "Texture - XNA Framework" to import an image.
// 'Custom' method
var myCustomObject = Content.Load<CompiledBNBImage>("gamedata"); // Uses my custom content Processor to return POCO "CompiledBNBImage"
byte[] myJPEGByteArray = myCustomObject.Image; // byte[] of jpeg
Texture2D texture2 = ???? // What is the best way to convert myJPEGByteArray to a Texture2D?
非常感谢您的帮助。:-)
DS