我正在尝试从Bitmap制作Texture2D。我有
Texture2D BitmapToTexture(Bitmap img)
{
var ret = new Texture2D(Game.GraphicsDevice, img.Width, img.Height);
var bd = img.LockBits(new Rectangle(0, 0, img.Width, img.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
int[] bytes = new int[img.Width * img.Height];
Marshal.Copy(bd.Scan0, bytes, 0, bytes.Length);
ret.SetData(bytes);
img.UnlockBits(bd);
return ret;
}
问题是SetData出于某种原因期待ABGR。有没有办法获得SetData 采取ARGB数据?