add a byte stream: pxl8_stream

This commit is contained in:
asrael 2025-10-12 05:02:19 -05:00
parent ede16ca7de
commit 82ed6b4ea9
7 changed files with 350 additions and 273 deletions

View file

@ -722,20 +722,20 @@ pxl8_result pxl8_gfx_load_palette(pxl8_gfx* gfx, const char* path) {
if (gfx->color_mode == PXL8_COLOR_MODE_HICOLOR) return PXL8_OK;
pxl8_debug("Loading palette from: %s", path);
pxl8_ase_file ase_file;
pxl8_result result = pxl8_ase_load(path, &ase_file);
if (result != PXL8_OK) {
pxl8_error("Failed to load ASE file for palette: %s", path);
return result;
}
if (ase_file.palette.entry_count == 0) {
if (ase_file.palette.entry_count == 0 || !ase_file.palette.colors) {
pxl8_error("No palette data in ASE file");
pxl8_ase_destroy(&ase_file);
return PXL8_ERROR_INVALID_FORMAT;
}
u32 copy_size = ase_file.palette.entry_count < gfx->palette_size
? ase_file.palette.entry_count
: gfx->palette_size;