add alpha/requireAlpha argument when decoding images

remove size checks from setImage (we are assuming the caller knows the correct size)
This also adds some monkey-patch methods to js_interop to convert Float32List to a UInt8List (but use this with care, because it will only work for emscripten-allocated objects)
This commit is contained in:
Nick Fisher
2025-05-29 22:26:42 +08:00
parent c789e75af5
commit 86894cf583
12 changed files with 115 additions and 61 deletions

View File

@@ -262,7 +262,7 @@ EMSCRIPTEN_KEEPALIVE TTextureUsage Texture_getUsage(TTexture *tTexture, uint32_t
EMSCRIPTEN_KEEPALIVE void Texture_generateMipMaps(TTexture *tTexture, TEngine *tEngine);
EMSCRIPTEN_KEEPALIVE TLinearImage *Image_createEmpty(uint32_t width,uint32_t height,uint32_t channel);
EMSCRIPTEN_KEEPALIVE TLinearImage *Image_decode(uint8_t* data, size_t length, const char* name);
EMSCRIPTEN_KEEPALIVE TLinearImage *Image_decode(uint8_t* data, size_t length, const char* name, bool alpha);
EMSCRIPTEN_KEEPALIVE float *Image_getBytes(TLinearImage *tLinearImage);
EMSCRIPTEN_KEEPALIVE void Image_destroy(TLinearImage *tLinearImage);
EMSCRIPTEN_KEEPALIVE uint32_t Image_getWidth(TLinearImage *tLinearImage);