to-bytes seems to be working
Once I debug both more thoroughly I think it might be close to having both to and from bytes working. Which is very good! Once that works I can get to and from ARGB working and then try and test it with real images.
|1 week ago|
|.gitignore||1 week ago|
|LICENSE||1 week ago|
|README.org||1 week ago|
|s2if.rkt||1 week ago|
Steve's Simple Image Format (SSIF) was for me a foray into completely unknown territory. I had done little to nothing with either graphics, or binary formats up until that point, and it was overall a fantastic learning experience for me. Overall I was an am very proud of it.
But I do think that I made a number of mistakes, and I want to take another go at making an image format in an attempt to maybe make some new mistakes and learn some more things along the way :)
So I have decided that I am going to use some form of LISP for this project, since I want to learn the ways of LISP better. That probably means Scheme. But which one to pick?
I think I'll go with Racket since that seems to have decent PNG support.
Has all the bells and whistles I could ever need built right in, but feels very "academic" and like a teaching language, not something truly meant for real work.
That's honestly a nitpick but still it bothers me.
The most mature and "real-language" feeling of the choices. Also learning Guile specifically has some benefits such as making my way toward learning more about Guix.
It's a neat language, and C interop is a cool feature. But I don't really want to deal with C interop.
Honorable mention to Clojure because I still find this language to be fascinating and it's probably the most "enterprise-y" of the LISP family.
This is the new method that should provide much more flexiblity than the previous method of compression. Colors are stored in an index at the beginning of the file, and then referenced by their index number. Colors at occur frequently then can be referenced by a single byte. The different compression levels allow for slightly different colors to be averaged and considered the same, reducing the index. The index can hold at most 254 different colors, since there are two bytes that are reserved for indicating color runs and unindexed colors.
The index contains at most 254 color assignments. First is a single byte that is the length of the index. Then there are that many blocks of 4 byte colors, for ARGB respectively.
The index is, at most 1017 bytes long (4 * 254 + 1), and ends after the final color has been read in the length.
The body of the file contains the pixel data and runs until the end of the file. Generally it is individual bytes that map to the color index above it. However there are two special cases for color runs and uncompressed pixels:
0xFFis found that indicates a color that has not been
0xFEis found that indicates the beginning of a color run.
See the section above on comporession algorithms for details on these structures.