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.
Checking the stable version of the documentation...
ImageFormatLoaderExtension
继承: ImageFormatLoader < RefCounted < Object
用于创建 ImageFormatLoader 扩展的基类(添加对额外图像格式的支持)。
描述
该引擎支持多种开箱即用的图像格式(PNG、SVG、JPEG、WebP 等),但也可以选择通过扩展该类,来实现对其他图像格式的支持。
请务必遵守文档中的返回类型和值。应该创建它的一个实例,并在初始化阶段调用 add_format_loader() 来注册该加载器。
方法
_get_recognized_extensions() virtual const |
|
_load_image(image: Image, fileaccess: FileAccess, flags: BitField[LoaderFlags], scale: float) virtual |
|
void |
|
void |
方法说明
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() 🔗
从引擎中移除这个格式加载器。