Debian Codegraph @

core/io/image.h

raw symbols SCIP
1 /**************************************************************************/
2 /* image.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #pragma once
32
33 #include "core/io/resource.h"
34 #include "core/math/color.h"
35
36 /**
37 * Image storage class. This is used to store an image in user memory, as well as
38 * providing some basic methods for image manipulation.
39 * Images can be loaded from a file, or registered into the Render object as textures.
40 */
41
42 class Image;
43
44 // Function pointer prototypes.
45
46 typedef Error (*SavePNGFunc)(const String &p_path, const Ref<Image> &p_img);
47 typedef Vector<uint8_t> (*SavePNGBufferFunc)(const Ref<Image> &p_img);
48
49 typedef Error (*SaveJPGFunc)(const String &p_path, const Ref<Image> &p_img, float p_quality);
50 typedef Vector<uint8_t> (*SaveJPGBufferFunc)(const Ref<Image> &p_img, float p_quality);
51
52 typedef Ref<Image> (*ImageMemLoadFunc)(const uint8_t *p_data, int p_size);
53 typedef Ref<Image> (*ScalableImageMemLoadFunc)(const uint8_t *p_data, int p_size, float p_scale);
54
55 typedef Error (*SaveWebPFunc)(const String &p_path, const Ref<Image> &p_img, const bool p_lossy, const float p_quality);
56 typedef Vector<uint8_t> (*SaveWebPBufferFunc)(const Ref<Image> &p_img, const bool p_lossy, const float p_quality);
57
58 typedef Error (*SaveEXRFunc)(const String &p_path, const Ref<Image> &p_img, bool p_grayscale);
59 typedef Vector<uint8_t> (*SaveEXRBufferFunc)(const Ref<Image> &p_img, bool p_grayscale);
60
61 typedef Error (*SaveDDSFunc)(const String &p_path, const Ref<Image> &p_img);
62 typedef Vector<uint8_t> (*SaveDDSBufferFunc)(const Ref<Image> &p_img);
63
64 class Image : public Resource {
65 GDCLASS(Image, Resource);
66
67 public:
68 enum {
69 MAX_WIDTH = (1 << 24), // Force a limit somehow.
70 MAX_HEIGHT = (1 << 24), // Force a limit somehow.
71 MAX_PIXELS = 268435456 // 16384 ^ 2
72 };
73
74 enum Format : int32_t {
75 FORMAT_L8, // Luminance
76 FORMAT_LA8, // Luminance-Alpha
77 FORMAT_R8,
78 FORMAT_RG8,
79 FORMAT_RGB8,
80 FORMAT_RGBA8,
81 FORMAT_RGBA4444,
82 FORMAT_RGB565,
83 FORMAT_RF, // Float
84 FORMAT_RGF,
85 FORMAT_RGBF,
86 FORMAT_RGBAF,
87 FORMAT_RH, // Half
88 FORMAT_RGH,
89 FORMAT_RGBH,
90 FORMAT_RGBAH,
91 FORMAT_RGBE9995,
92 FORMAT_DXT1, // BC1
93 FORMAT_DXT3, // BC2
94 FORMAT_DXT5, // BC3
95 FORMAT_RGTC_R, // BC4
96 FORMAT_RGTC_RG, // BC5
97 FORMAT_BPTC_RGBA, // BC7
98 FORMAT_BPTC_RGBF, // BC6 Signed
99 FORMAT_BPTC_RGBFU, // BC6 Unsigned
100 FORMAT_ETC, // ETC1
101 FORMAT_ETC2_R11,
102 FORMAT_ETC2_R11S, // Signed, NOT srgb.
103 FORMAT_ETC2_RG11,
104 FORMAT_ETC2_RG11S, // Signed, NOT srgb.
105 FORMAT_ETC2_RGB8,
106 FORMAT_ETC2_RGBA8,
107 FORMAT_ETC2_RGB8A1,
108 FORMAT_ETC2_RA_AS_RG, // ETC2 RGBA with a RA-RG swizzle for normal maps.
109 FORMAT_DXT5_RA_AS_RG, // BC3 with a RA-RG swizzle for normal maps.
110 FORMAT_ASTC_4x4,
111 FORMAT_ASTC_4x4_HDR,
112 FORMAT_ASTC_8x8,
113 FORMAT_ASTC_8x8_HDR,
114 FORMAT_R16,
115 FORMAT_RG16,
116 FORMAT_RGB16,
117 FORMAT_RGBA16,
118 FORMAT_R16I,
119 FORMAT_RG16I,
120 FORMAT_RGB16I,
121 FORMAT_RGBA16I,
122 FORMAT_MAX
123 };
124
125 static const char *format_names[FORMAT_MAX];
126
127 enum Interpolation {
128 INTERPOLATE_NEAREST,
129 INTERPOLATE_BILINEAR,
130 INTERPOLATE_CUBIC,
131 INTERPOLATE_TRILINEAR,
132 INTERPOLATE_LANCZOS,
133 // INTERPOLATE_TRICUBIC,
134 // INTERPOLATE_GAUSS
135 };
136
137 // Used for obtaining optimal compression quality.
138 enum UsedChannels {
139 USED_CHANNELS_L,
140 USED_CHANNELS_LA,
141 USED_CHANNELS_R,
142 USED_CHANNELS_RG,
143 USED_CHANNELS_RGB,
144 USED_CHANNELS_RGBA,
145 };
146
147 // ASTC supports block formats other than 4x4.
148 enum ASTCFormat {
149 ASTC_FORMAT_4x4,
150 ASTC_FORMAT_8x8,
151 };
152
153 enum RoughnessChannel {
154 ROUGHNESS_CHANNEL_R,
155 ROUGHNESS_CHANNEL_G,
156 ROUGHNESS_CHANNEL_B,
157 ROUGHNESS_CHANNEL_A,
158 ROUGHNESS_CHANNEL_L,
159 };
160
161 enum Image3DValidateError {
162 VALIDATE_3D_OK,
163 VALIDATE_3D_ERR_IMAGE_EMPTY,
164 VALIDATE_3D_ERR_MISSING_IMAGES,
165 VALIDATE_3D_ERR_EXTRA_IMAGES,
166 VALIDATE_3D_ERR_IMAGE_SIZE_MISMATCH,
167 VALIDATE_3D_ERR_IMAGE_FORMAT_MISMATCH,
168 VALIDATE_3D_ERR_IMAGE_HAS_MIPMAPS,
169 };
170
171 enum CompressMode {
172 COMPRESS_S3TC,
173 COMPRESS_ETC,
174 COMPRESS_ETC2,
175 COMPRESS_BPTC,
176 COMPRESS_ASTC,
177 COMPRESS_MAX,
178 };
179
180 enum CompressSource {
181 COMPRESS_SOURCE_GENERIC,
182 COMPRESS_SOURCE_SRGB,
183 COMPRESS_SOURCE_NORMAL,
184 COMPRESS_SOURCE_MAX,
185 };
186
187 enum AlphaMode {
188 ALPHA_NONE,
189 ALPHA_BIT,
190 ALPHA_BLEND
191 };
192
193 struct BasisUniversalPackerParams {
194 int uastc_level = 0;
195 float rdo_quality_loss = 0;
196 };
197
198 // External saver function pointers.
199
200 static inline SavePNGFunc save_png_func = nullptr;
201 static inline SaveJPGFunc save_jpg_func = nullptr;
202 static inline SaveEXRFunc save_exr_func = nullptr;
203 static inline SaveWebPFunc save_webp_func = nullptr;
204 static inline SaveDDSFunc save_dds_func = nullptr;
205 static inline SavePNGBufferFunc save_png_buffer_func = nullptr;
206 static inline SaveEXRBufferFunc save_exr_buffer_func = nullptr;
207 static inline SaveJPGBufferFunc save_jpg_buffer_func = nullptr;
208 static inline SaveWebPBufferFunc save_webp_buffer_func = nullptr;
209 static inline SaveDDSBufferFunc save_dds_buffer_func = nullptr;
210
211 // External loader function pointers.
212
213 static inline ImageMemLoadFunc _png_mem_loader_func = nullptr;
214 static inline ImageMemLoadFunc _png_mem_unpacker_func = nullptr;
215 static inline ImageMemLoadFunc _jpg_mem_loader_func = nullptr;
216 static inline ImageMemLoadFunc _webp_mem_loader_func = nullptr;
217 static inline ImageMemLoadFunc _tga_mem_loader_func = nullptr;
218 static inline ImageMemLoadFunc _bmp_mem_loader_func = nullptr;
219 static inline ScalableImageMemLoadFunc _svg_scalable_mem_loader_func = nullptr;
220 static inline ImageMemLoadFunc _ktx_mem_loader_func = nullptr;
221 static inline ImageMemLoadFunc _dds_mem_loader_func = nullptr;
222 static inline ImageMemLoadFunc _exr_mem_loader_func = nullptr;
223
224 // External VRAM compression function pointers.
225
226 static void (*_image_compress_bc_func)(Image *, UsedChannels p_channels);
227 static void (*_image_compress_bptc_func)(Image *, UsedChannels p_channels);
228 static void (*_image_compress_etc1_func)(Image *);
229 static void (*_image_compress_etc2_func)(Image *, UsedChannels p_channels);
230 static void (*_image_compress_astc_func)(Image *, ASTCFormat p_format);
231
232 static Error (*_image_compress_bptc_rd_func)(Image *, UsedChannels p_channels);
233 static Error (*_image_compress_bc_rd_func)(Image *, UsedChannels p_channels);
234
235 // External VRAM decompression function pointers.
236
237 static void (*_image_decompress_bc)(Image *);
238 static void (*_image_decompress_bptc)(Image *);
239 static void (*_image_decompress_etc1)(Image *);
240 static void (*_image_decompress_etc2)(Image *);
241 static void (*_image_decompress_astc)(Image *);
242
243 // External packer function pointers.
244
245 static Vector<uint8_t> (*webp_lossy_packer)(const Ref<Image> &p_image, float p_quality);
246 static Vector<uint8_t> (*webp_lossless_packer)(const Ref<Image> &p_image);
247 static Vector<uint8_t> (*png_packer)(const Ref<Image> &p_image);
248 static Vector<uint8_t> (*basis_universal_packer)(const Ref<Image> &p_image, UsedChannels p_channels, const BasisUniversalPackerParams &p_basisu_params);
249
250 static Ref<Image> (*webp_unpacker)(const Vector<uint8_t> &p_buffer);
251 static Ref<Image> (*png_unpacker)(const Vector<uint8_t> &p_buffer);
252 static Ref<Image> (*basis_universal_unpacker)(const Vector<uint8_t> &p_buffer);
253 static Ref<Image> (*basis_universal_unpacker_ptr)(const uint8_t *p_data, int p_size);
254
255 protected:
256 virtual Ref<Resource> _duplicate(const DuplicateParams &p_params) const override;
257
258 static void _bind_methods();
259
260 private:
261 Format format = FORMAT_L8;
262 Vector<uint8_t> data;
263 int width = 0;
264 int height = 0;
265 bool mipmaps = false;
266
267 void _copy_internals_from(const Image &p_image);
268
269 _FORCE_INLINE_ Color _get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const;
270 _FORCE_INLINE_ void _set_color_at_ofs(uint8_t *ptr, uint32_t ofs, const Color &p_color);
271
272 _FORCE_INLINE_ void _get_mipmap_offset_and_size(int p_mipmap, int64_t &r_offset, int &r_width, int &r_height) const; // Get where the mipmap begins in data.
273
274 static int64_t _get_dst_image_size(int p_width, int p_height, Format p_format, int &r_mipmaps, int p_mipmaps = -1, int *r_mm_width = nullptr, int *r_mm_height = nullptr);
275
276 _FORCE_INLINE_ void _get_clipped_src_and_dest_rects(const Ref<Image> &p_src, const Rect2i &p_src_rect, const Point2i &p_dest, Rect2i &r_clipped_src_rect, Rect2i &r_clipped_dest_rect) const;
277
278 _FORCE_INLINE_ void _put_pixelb(int p_x, int p_y, uint32_t p_pixel_size, uint8_t *p_data, const uint8_t *p_pixel);
279 _FORCE_INLINE_ void _get_pixelb(int p_x, int p_y, uint32_t p_pixel_size, const uint8_t *p_data, uint8_t *p_pixel);
280
281 _FORCE_INLINE_ void _repeat_pixel_over_subsequent_memory(uint8_t *p_pixel, int p_pixel_size, int p_count);
282
283 void _set_data(const Dictionary &p_data);
284 Dictionary _get_data() const;
285
286 Error _load_from_buffer(const Vector<uint8_t> &p_array, ImageMemLoadFunc p_loader);
287
288 _FORCE_INLINE_ void _generate_mipmap_from_format(Image::Format p_format, const uint8_t *p_src, uint8_t *p_dst, uint32_t p_width, uint32_t p_height, bool p_renormalize = false);
289
290 static void average_4_uint8(uint8_t &p_out, const uint8_t &p_a, const uint8_t &p_b, const uint8_t &p_c, const uint8_t &p_d);
291 static void average_4_float(float &p_out, const float &p_a, const float &p_b, const float &p_c, const float &p_d);
292 static void average_4_half(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d);
293 static void average_4_rgbe9995(uint32_t &p_out, const uint32_t &p_a, const uint32_t &p_b, const uint32_t &p_c, const uint32_t &p_d);
294 static void average_4_uint16(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d);
295 static void average_4_rgba4444(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d);
296 static void average_4_rgb565(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d);
297
298 static void renormalize_uint8(uint8_t *p_rgb);
299 static void renormalize_float(float *p_rgb);
300 static void renormalize_half(uint16_t *p_rgb);
301 static void renormalize_uint16(uint16_t *p_rgb);
302
303 public:
304 int get_width() const;
305 int get_height() const;
306 Size2i get_size() const;
307 bool has_mipmaps() const;
308 int get_mipmap_count() const;
309
310 // Convert the image to another format, conversion only to raw byte format.
311 void convert(Format p_new_format);
312
313 Format get_format() const;
314
315 // Get where the mipmap begins in data.
316 int64_t get_mipmap_offset(int p_mipmap) const;
317 void get_mipmap_offset_and_size(int p_mipmap, int64_t &r_ofs, int64_t &r_size) const;
318 void get_mipmap_offset_size_and_dimensions(int p_mipmap, int64_t &r_ofs, int64_t &r_size, int &w, int &h) const;
319
320 static Image3DValidateError validate_3d_image(Format p_format, int p_width, int p_height, int p_depth, bool p_mipmaps, const Vector<Ref<Image>> &p_images);
321 static String get_3d_image_validation_error_text(Image3DValidateError p_error);
322
323 // Resize the image, using the preferred interpolation method.
324 void resize_to_po2(bool p_square = false, Interpolation p_interpolation = INTERPOLATE_BILINEAR);
325 void resize(int p_width, int p_height, Interpolation p_interpolation = INTERPOLATE_BILINEAR);
326 void shrink_x2();
327 bool is_size_po2() const;
328
329 // Crop the image to a specific size, if larger, then the image is filled by black.
330 void crop_from_point(int p_x, int p_y, int p_width, int p_height);
331 void crop(int p_width, int p_height);
332
333 void rotate_90(ClockDirection p_direction);
334 void rotate_180();
335
336 void flip_x();
337 void flip_y();
338
339 // Generate a mipmap chain of an image (creates an image 1/4 the size, with averaging of 4->1).
340 Error generate_mipmaps(bool p_renormalize = false);
341
342 Error generate_mipmap_roughness(RoughnessChannel p_roughness_channel, const Ref<Image> &p_normal_map);
343
344 void clear_mipmaps();
345 void normalize();
346
347 // Creates new internal image data of a given size and format. Current image will be lost.
348 void initialize_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format);
349 void initialize_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data);
350 void initialize_data(const char **p_xpm);
351
352 // Returns true when the image is empty (0,0) in size.
353 bool is_empty() const;
354
355 Vector<uint8_t> get_data() const;
356
357 Error load(const String &p_path);
358 static Ref<Image> load_from_file(const String &p_path);
359 Error save_png(const String &p_path) const;
360 Error save_jpg(const String &p_path, float p_quality = 0.75) const;
361 Error save_dds(const String &p_path) const;
362 Vector<uint8_t> save_png_to_buffer() const;
363 Vector<uint8_t> save_jpg_to_buffer(float p_quality = 0.75) const;
364 Vector<uint8_t> save_exr_to_buffer(bool p_grayscale = false) const;
365 Vector<uint8_t> save_dds_to_buffer() const;
366 Error save_exr(const String &p_path, bool p_grayscale = false) const;
367 Error save_webp(const String &p_path, const bool p_lossy = false, const float p_quality = 0.75f) const;
368 Vector<uint8_t> save_webp_to_buffer(const bool p_lossy = false, const float p_quality = 0.75f) const;
369
370 static Ref<Image> create_empty(int p_width, int p_height, bool p_use_mipmaps, Format p_format);
371 static Ref<Image> create_from_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data);
372 void set_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data);
373
374 Image() = default; // Create an empty image.
375 Image(int p_width, int p_height, bool p_use_mipmaps, Format p_format); // Create an empty image of a specific size and format.
376 Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector<uint8_t> &p_data); // Import an image of a specific size and format from a byte vector.
377 Image(const uint8_t *p_mem_png_jpg, int p_len = -1); // Import either a png or jpg from a pointer.
378 Image(const char **p_xpm); // Import an XPM image.
379
380 AlphaMode detect_alpha() const;
381 bool is_invisible() const;
382
383 static int get_format_pixel_size(Format p_format);
384 static int get_format_pixel_rshift(Format p_format);
385 static int get_format_block_size(Format p_format);
386 static void get_format_min_pixel_size(Format p_format, int &r_w, int &r_h);
387
388 static int64_t get_image_data_size(int p_width, int p_height, Format p_format, bool p_mipmaps = false);
389 static int get_image_required_mipmaps(int p_width, int p_height, Format p_format);
390 static Size2i get_image_mipmap_size(int p_width, int p_height, Format p_format, int p_mipmap);
391 static int64_t get_image_mipmap_offset(int p_width, int p_height, Format p_format, int p_mipmap);
392 static int64_t get_image_mipmap_offset_and_dimensions(int p_width, int p_height, Format p_format, int p_mipmap, int &r_w, int &r_h);
393
394 Error compress(CompressMode p_mode, CompressSource p_source = COMPRESS_SOURCE_GENERIC, ASTCFormat p_astc_format = ASTC_FORMAT_4x4);
395 Error compress_from_channels(CompressMode p_mode, UsedChannels p_channels, ASTCFormat p_astc_format = ASTC_FORMAT_4x4);
396 Error decompress();
397 bool is_compressed() const;
398 static bool is_format_compressed(Format p_format);
399
400 static bool can_decompress(const String &p_format_tag);
401
402 void fix_alpha_edges();
403 void premultiply_alpha();
404 void srgb_to_linear();
405 void linear_to_srgb();
406 void normal_map_to_xy();
407 Ref<Image> rgbe_to_srgb();
408 Ref<Image> get_image_from_mipmap(int p_mipmap) const;
409 void bump_map_to_normal_map(float bump_scale = 1.0);
410
411 bool detect_signed(bool p_include_mips = true) const;
412
413 void blit_rect(const Ref<Image> &p_src, const Rect2i &p_src_rect, const Point2i &p_dest);
414 void blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, const Rect2i &p_src_rect, const Point2i &p_dest);
415 void blend_rect(const Ref<Image> &p_src, const Rect2i &p_src_rect, const Point2i &p_dest);
416 void blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, const Rect2i &p_src_rect, const Point2i &p_dest);
417 void fill(const Color &p_color);
418 void fill_rect(const Rect2i &p_rect, const Color &p_color);
419
420 Rect2i get_used_rect() const;
421 Ref<Image> get_region(const Rect2i &p_area) const;
422
423 static String get_format_name(Format p_format);
424 static uint32_t get_format_component_mask(Format p_format);
425
426 Error load_png_from_buffer(const Vector<uint8_t> &p_array);
427 Error load_jpg_from_buffer(const Vector<uint8_t> &p_array);
428 Error load_webp_from_buffer(const Vector<uint8_t> &p_array);
429 Error load_tga_from_buffer(const Vector<uint8_t> &p_array);
430 Error load_bmp_from_buffer(const Vector<uint8_t> &p_array);
431 Error load_ktx_from_buffer(const Vector<uint8_t> &p_array);
432 Error load_dds_from_buffer(const Vector<uint8_t> &p_array);
433 Error load_exr_from_buffer(const Vector<uint8_t> &p_array);
434
435 Error load_svg_from_buffer(const Vector<uint8_t> &p_array, float scale = 1.0);
436 Error load_svg_from_string(const String &p_svg_str, float scale = 1.0);
437
438 void convert_rg_to_ra_rgba8();
439 void convert_ra_rgba8_to_rg();
440 void convert_rgba8_to_bgra8();
441
442 UsedChannels detect_used_channels(CompressSource p_source = COMPRESS_SOURCE_GENERIC) const;
443 void optimize_channels();
444
445 Color get_pixelv(const Point2i &p_point) const;
446 Color get_pixel(int p_x, int p_y) const;
447 void set_pixelv(const Point2i &p_point, const Color &p_color);
448 void set_pixel(int p_x, int p_y, const Color &p_color);
449
450 const uint8_t *ptr() const;
451 uint8_t *ptrw();
452 int64_t get_data_size() const;
453
454 void adjust_bcs(float p_brightness, float p_contrast, float p_saturation);
455
456 void set_as_black();
457
458 void copy_internals_from(const Ref<Image> &p_image);
459
460 Dictionary compute_image_metrics(const Ref<Image> p_compared_image, bool p_luma_metric = true);
461 };
462
463 VARIANT_ENUM_CAST(Image::Format)
464 VARIANT_ENUM_CAST(Image::Interpolation)
465 VARIANT_ENUM_CAST(Image::CompressMode)
466 VARIANT_ENUM_CAST(Image::CompressSource)
467 VARIANT_ENUM_CAST(Image::UsedChannels)
468 VARIANT_ENUM_CAST(Image::AlphaMode)
469 VARIANT_ENUM_CAST(Image::RoughnessChannel)
470 VARIANT_ENUM_CAST(Image::ASTCFormat)