c# - 在 UWP 应用程序中加载和显示 DDS (DXT1) 文件

标签 c# c++ xaml win-universal-app dds-format

我想加载几个 directdraw 表面文件,特别是 DXT1,并在我非常简单的 UWP(主要是 C#)应用程序中显示它们。

我读过 DirectXTex,但我不知道这是否是最简单的方法,如果是,如何在 UWP 应用程序中使用它。

最佳答案

在 Windows 8.1 和 Windows 10 中,Windows Imaging Component有一个内置的编解码器,用于加载使用 BC1/DXT1 压缩的 DDS 文件。从 C# UWP 使用 WIC 的最简单方法是使用 Win2D .请记住,WIC 将返回图像的未压缩版本,如果这是您想要的,那么您就可以开始了。

Note that the built-in DDS codec only supports DXT1-DXT5/BC1-BC3 2D image files. It won't load other forms of DDS files. A quick way to check is to look in File Explorer. If the DDS shows up with a thumbnail, it's supported.

从您的问题中不清楚您将如何处理加载的数据。如果你想在 C# 中使用 Direct3D,那么你应该看看类似 SharpDX 的内容。或 SlimDX .如果您使用的是 Direct2D,Win2D 是最佳选择。

For when to use DirectXTex vs. DDSTextureLoader for loading DDS files, see this blog post. In short: DirectXTex is for tools that need to handle all the various format conversions particularly legacy DDS file formats; DDSTextureLoader in DirectX Tool Kit is intended for 'runtime' use where you can ensure you are loading a DDS file that is already in a supported DXGI format.

关于c# - 在 UWP 应用程序中加载和显示 DDS (DXT1) 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37033835/

相关文章:

c++ - 在函数范围内分配到堆栈上的数组是否总是在离开函数时被释放?

wpf - 如何在 WPF 中提供字符串文字值作为绑定(bind)

wpf - 在 WPF 中更改标签的样式和模板

c# - 如何使用 Owin 托管存储 session 数据?

c# - 如何从十进制字符串中去除零和小数点?

c# - 此 C# Razor 语法的 VB.NET 等价物是什么?

c# - 在powerpoint中使用OpenXML创建表

c# - 如何在c#中访问基类数据

c++ - 我应该压制吗?如果是这样如何从 Makefile 中抑制

c++ - Emacs C/C++ 注释填充 : want paragraphs in comment to not be merged