Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

ImageFormatLoaderExtension

繼承: ImageFormatLoader < RefCounted < Object

用於建立 ImageFormatLoader 擴充的基底類別(新增對額外圖像格式的支援)。

說明

該引擎支援多種開箱即用的圖像格式(PNG、SVG、JPEG、WebP 等),但也可以選擇通過擴充該類,來實作對其他圖像格式的支援。

請務必遵守文件中的返回型別和值。應該建立它的一個實例,並在初始化階段呼叫 add_format_loader() 來註冊該載入器。

方法

PackedStringArray

_get_recognized_extensions() virtual const

Error

_load_image(image: Image, fileaccess: FileAccess, flags: BitField[LoaderFlags], scale: float) virtual

void

add_format_loader()

void

remove_format_loader()


方法說明

PackedStringArray _get_recognized_extensions() virtual const 🔗

返回該圖像格式的檔副檔名列表。具有給定副檔名的檔將被視為影像檔並使用該類載入。


Error _load_image(image: Image, fileaccess: FileAccess, flags: BitField[LoaderFlags], scale: float) virtual 🔗

fileaccess 的內容載入至提供的 image


void add_format_loader() 🔗

將這個格式載入器新增至引擎,使其能夠識別 _get_recognized_extensions() 返回的檔案副檔名。


void remove_format_loader() 🔗

從引擎中移除這個格式載入器。