RandyGaul / cute_headers

Collection of cross-platform one-file C/C++ libraries with no dependencies, primarily used for games
4.33k stars 269 forks source link

cute_aseprite: Add chunck 0x0004 support #376

Closed redbug26 closed 6 months ago

redbug26 commented 9 months ago

With last version of aseprite (v1.3.2), when we save a file where no alpha is used in the palette, only the chunk 0x0004 is created (not the 0x2019). 0x0004 chunk support is then needed

redbug26 commented 9 months ago

From doc:

Old palette chunk (0x0004): Ignore this chunk if you find the new palette chunk (0x2019) Aseprite v1.1 saves both chunks 0x0004 and 0x2019 just for backward compatibility.

This chunk is thus mandatory if chunk 2019 is not available.

From source:

Chunk 0x2019 is only available if: if (pal->size() != 256 || pal->hasAlpha()) {

RobLoach commented 7 months ago

Getting one warning when strict compiling....

cute_aseprite.h: In function ‘cute_aseprite_load_from_memory’:
cute_aseprite.h:1014:83: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Wconversion]
 1014 |                                                 if (skip+l > maxColor) maxColor = skip+l;