Post Reply 
Sprite encoding/decoding for compact graphics data
08-21-2015, 08:43 PM
Post: #3
RE: Sprite encoding/decoding for compact graphics data
Thank you for your comments.

The solution is rather for game developers.
Binary PNG files can be used only in application libraries in HP Prime and not in the 1-file programs in the program catalog, so not everyone uses them.

And yes, this encoding is smaller than PNG especially with small color palette, but in some cases may happen exceptions.
In general, for more complicated sprite (less compressible) is more worth to use my method.

However, smaller sprites provide also greater profit. If someone uses a lot of small sprites the solution is for him.
Note that PNG also optimizes the color palette. Simple sprites as those of example EncDecSprite15c consist of four-six colors, but was encoded by me using 15 colors. Using a palette 4 color the final result can be reduced even by half (25 characters per sprite 14x14).
The smallest PNG file which I was able to generate the size of 2x2 (4 pixels) of the two colors was the size more than 80 bytes after optimization (take a look at the attachment).
At this size of a sprite using my method you can store the sprite size 12x12 of 15 colors or size 6x6 of 16-bit color.

In addition, most developers just encodes the graphics data in the source code using integers lists (for using with DIMGROB_P) so there is a lot of completed programs which now can be reduced without major modifications to the source code.

A similar method can be used also to encode levels in games like Sokoban Wink
Combined with RLE which is used there we can get really interesting results.

I hope that it will be useful for someone.

BR
Piotr


Attached File(s)
.zip  PNGs.zip (Size: 1.61 KB / Downloads: 5)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Sprite encoding/decoding for compact graphics data - komame - 08-21-2015 08:43 PM



User(s) browsing this thread: 1 Guest(s)