問題描述
是否可以使用 Win32 GDI 函數將文件中的 PNG 加載到 HBITMAP 中?如果沒有,不使用外部庫(如 libpng)的最輕量級解決方案是什么?
Is it possible to load a PNG from a file into an HBITMAP using Win32 GDI functions? If not, what would be the lightest solution without using external libraries (like libpng)?
推薦答案
您可以使用 Windows Imaging Component 加載 PNG 文件(在 Windows XP SP2 和更高版本上).請參閱 MSDN 雜志,了解如何使用 API一個 rel="nofollow noreferrer">我的博客文章,用于從 IStream 加載 PNG 并將其轉換為HBITMAP.
You can use the Windows Imaging Component to load PNG files (on Windows XP SP2 and later). See MSDN Magazine for an introduction on how to use the API and my blog post for a code sample that loads a PNG from an IStream and converts it to an HBITMAP.
這篇關于我將如何使用 Win32/GDI 加載 PNG 圖像(如果可能,不使用 GDI+)?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!