|Steven vanZyl bfabcf997d Various improvements and documantation||1 week ago|
|samples||1 week ago|
|src||1 week ago|
|.gitignore||1 month ago|
|Cargo.toml||1 week ago|
|LICENSE||1 week ago|
|README.md||1 month ago|
|logo.png||1 week ago|
This is a simple graphical image format that I created as a challenge for myself: To design and create an image format, with decoder, in a day.
I chose Rust simply because I like it and thought it was suitable for this project. Additionally I intend to write a simple web decoder which possibly will use WebAssembly so Rust is quite suited.
Every file begins with the header which is exactly 7 bytes long and is composed of:
The magic number identifies this file as a SSIF file regardless of the file extension or any other interference.
The version number is used for compatibility purposes with other versions of the format.
The width and height are conviences for developers so that the format can
easily be read into a fixed sized buffer with the size known beforehand.
This does however limit the image to a total of
Past the header is the actual file data, which can be broken up into 3-byte segments. These 2 bytes contain:
The length of the data section must be a mutiple of 3. Any additional bytes will be ignored.
The color data itself is contained within two bytes representing RGBA in 4-bits each in exactly that order. The individual color values can be extracted using standard bit-shifting or bit-masking methods.
Colors go up in intensity and alpha goes up in opacity. Therefore
FF FF is
00 00 is completely transparent and
00 0F is black.
The colorspace is rather limited but for my purposes I wanted that.
The second byte is defines the “run” length of this color, or the horizontal length along this row of pixels to use this color. This is a form of basic compression. A length of 1 means this is only one pixel, a length of 100 means this is a line 100 pixels long. Runs longer than or going off the end of a row are considered valid and will wrap onto the next line.