AustinEast / heaps-aseprite

An Aseprite File Parser for Heaps
https://lib.haxe.org/p/heaps-aseprite/
MIT License
28 stars 8 forks source link

Layer blend and opacity #11

Open jeremyfa opened 1 year ago

jeremyfa commented 1 year ago

It seems layer blend and opacity are not supported at the moment. Not using heaps-aseprite directly but noticed that by reading the code (and seeing opacity not taken into account in LDtk).

In my journey to implement aseprite support for Ceramic, I ported original aseprite's blend functions to Haxe, that you can find here: https://github.com/ceramic-engine/ceramic/blob/master/plugins/ase/runtime/src/ceramic/AsepriteBlendFuncs.hx

Sharing that as it could be interesting to use that in heaps-aseprite as well to improve support of layer blend/opacity (and make that work in LDtk as well?).

The actual parsing of ase data in Ceramic, also using the blend functions, can be found there: https://github.com/ceramic-engine/ceramic/blob/master/plugins/ase/runtime/src/ceramic/AsepriteParser.hx

jeremyfa commented 1 year ago

I guess you'd need to provide your own color type if you use this AsepriteBlendFuncs file, as my implementation is using an abstract specific to Ceramic, but should be easy to adapt so far.