gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 02:07:11 25 4
gpt4 key购买 nike

我想加载几个 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com