libspng
libspng copied to clipboard
Premultiply alpha option
Most graphics libs (all?) can only blend premultiplied-alpha sources. Maybe out-of-scope for libspng, but since libpng has the feature, it may be worth to add it.
EDIT: Note that most PNGs in the wild are already in premultiplied alpha but there's no bit in the file to tell if that's the case. So most (all?) of the time a premultiply pass would just be a waste of energy to satisfy the spec. AFAIR the loading time in libpng doubles because of this (tested that years ago, that might have changed).
Here's the code for it in case anyone needs it: https://github.com/luapower/libspng/blob/master/csrc/libspng/premultiply.c