如何将 .dds 文件加载到图片框中?
如何在 C# 中将 .dds 纹理文件加载为图像? 我在谷歌上找不到任何有用的东西。
你给我的信息和样本越多,我就越能理解它。
How do I load .dds texture files as an Image in C#? There's nothing useful on google that I could find.
The more information with samples you give me,the better it will be for me to understand it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到过同样的问题。 这是一个很好的解决方案。
使用我在下面提供的代码。
PictureBox1.Image = DevIL.DevIL.LoadBitmap(DDS_File_Path)
就是这么简单。 我们欠 DevIL .NET Wrapper 创建者一杯啤酒。
I had the same issue. Here is a good solution.
Use the code that I have supplied below.
PictureBox1.Image = DevIL.DevIL.LoadBitmap(DDS_File_Path)
It's really that easy. We owe the DevIL .NET Wrapper creator a beer.
我认为简短的回答是你不知道。 文档说支持的格式是BMP, GIF、EXIG、JPG、PNG 和 TIFF。
更新:似乎可以通过 Google 找到许多转换器,这可能会帮助你。 另外,正如 Wayne 建议的那样,看看 XNA(如果您还没有)。 Texture2D.FromFile 方法似乎可以处理 .dds 文件,但是我自己从未使用过它,所以我不能说它是否是您正在寻找的......
I think the short answer is that you don't. The documentation says that the supported formats are BMP, GIF, EXIG, JPG, PNG and TIFF.
Update: there seem to be a number of converters to be found through Google, that might help you out. Also, as Wayne suggests, look at XNA (if you didn't already). The Texture2D.FromFile method seems to handle the .dds files, but I never used it myself so I can't say if it is what you are looking for or not...
您可能想看看 Microsoft 的 XNA Game Studio SDK将纹理加载到内存中,并可能以 System.Drawing.Graphics 可用的方式捕获图像。
You might want to take a look at the Microsoft's XNA Game Studio SDK to load the textures in memory and possibly capture the images in a System.Drawing.Graphics usable way.