Bitmap bmp = new Bitmap();
.. Draw sth on bmp
MemoryStream ms = new MemoryStream();
bmp.Save(ms, bmp.Length);
ms.Position = 0; // 这步是不可缺的,否则异常
Texture texture = TextureLoad.FromStream(ms, ms.Length);
本文介绍了一种使用 C# 进行图片处理的方法,包括创建位图、绘制图形到位图、将位图保存为内存流以及从内存流加载纹理的过程。此方法适用于需要在内存中处理图像并转换为纹理的应用场景。
Bitmap bmp = new Bitmap();
.. Draw sth on bmp
MemoryStream ms = new MemoryStream();
bmp.Save(ms, bmp.Length);
ms.Position = 0; // 这步是不可缺的,否则异常
Texture texture = TextureLoad.FromStream(ms, ms.Length);
676
4016
3040

被折叠的 条评论
为什么被折叠?