Adiciona registro de formatos no core e tinyblocks-image (ops genericas + Load/Save)
This commit is contained in:
1 parent
fca7aa2f63
commit
f4e2556110
11 files changed
+479
-9
No files matched your search
@@ -31,6 +31,20 @@ TB_API bool tb_image_set_pixel(TinyBlocks_Image* img, int x, int y,
|
||||
TB_API bool tb_image_get_pixel(const TinyBlocks_Image* img, int x, int y,
|
||||
uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a);
|
||||
|
||||
/* -- Registro de formatos (alimentado pelas libraries ppm/bmp/png/jpg) ---
|
||||
* A library guarda-chuva tinyblocks-image usa este registro para carregar e
|
||||
* gravar imagens escolhendo o decodificador/codificador pela extensao do
|
||||
* arquivo, sem depender diretamente das libraries de formato. */
|
||||
typedef TinyBlocks_Image* (*TbImageDecoder)(const char* path);
|
||||
typedef bool (*TbImageEncoder)(const TinyBlocks_Image* img, const char* path);
|
||||
|
||||
TB_API bool tb_image_register_format(const char* ext,
|
||||
TbImageDecoder dec, TbImageEncoder enc);
|
||||
TB_API int tb_image_format_count(void);
|
||||
/* Carrega/grava escolhendo o formato pela extensao do caminho. */
|
||||
TB_API TinyBlocks_Image* tb_image_load(const char* path);
|
||||
TB_API bool tb_image_save(const TinyBlocks_Image* img, const char* path);
|
||||
|
||||
/* -- Helpers para TinyBlocks_Value --- */
|
||||
TB_API TinyBlocks_Value tb_value_image (TinyBlocks_Image* img); /* retém ref */
|
||||
TB_API TinyBlocks_Image* tb_value_as_image(TinyBlocks_Value v);
|
||||
|
||||
Reference in new issue
Block a user