I am trying to “hack” the spritesheets limitations by using JPG images with alpha channel.
Using JPGs is useful when the frames of the sequence are too complex and rich of details to be saved in PNG format without obtaining a very big file.
The process is simple:
- I have a starting PNG with alpha channel
- from this PNG I save a JPG (with varying fill colour for originally transparent areas)
- from the PNG I extract the alpha channel and save it as an opaque indexed colour grayscale image
- I load the new JPG and the grayscale PNG, and use the PNG as alpha channel for the JPG.
These are the two images, the JPG and the grayscale PNG
animBitmapData is BitmapData from the JPG
animBitmapData_ALPHA is BitmapData from the grayscale PNG
I did everything, but the last step doesn’t work,
animBitmapData is still opaque
animBitmapData.copyChannel(animBitmapData_ALPHA, animBitmapData_ALPHA.rect, new Point(0, 0), BitmapDataChannel.RED, BitmapDataChannel.ALPHA);
animBitmapData.transparent returns false, could this be the problem?