无后缀的图片文件显示
tirrcute opened this issue · 1 comments
tirrcute commented
您好,请问下minigui有根据文件内容判断图片格式的API嘛,目前读取一张无后缀的图片或者后缀信息错误(比如是png格式,后缀写成jpg格式)的时候bitmap好像加载不出来了。
VincentWei commented
You can do the following steps:
- Call
MGUI_RWFromFile
to create anMG_RWops
object. - Call
CheckBitmapType
function to determine the file type. This function will returns the correct extension name of the image file type if it can be distinguished by MiniGUI. - Call
LoadBitmapEx2
or other API to load the bitmap from theMG_RWops
object and the extension name returned byCheckBitmapType
. - Do something with the newly loaded BITMAP object.
- Destroy the
MG_RWops
object by callingMGUI_RWclose
.
Good Luck!