-
Notifications
You must be signed in to change notification settings - Fork 0
File formats
Each file is packed into an application file with a .wapp
extension (see wapp file). WAPP file can handle files not bigger than 64kB (0xFFFF
as size), so this is the limitation of every resource the application can use. In addition, the file name is limited to 254 characters (255 with a null-terminator).
It is a 2-bit greyscale image with a 2-bit alpha channel compressed by the RLE algorithm.
offset | size | value | description |
---|---|---|---|
00 |
1 |
Image width | |
01 |
1 |
Image height | |
02.. |
var | Pixel data (upper-left origin) | |
-02 |
2 |
FFFF |
File magic (last two bytes) |
Image data is a series of tuples (2-byte pairs) of RLE compressed pixel data. Each tuple consists of the following:
1 byte | 1 byte |
---|---|
count | 0b0000AALL |
Count specifies how many times a particular pixel has to be repeated. The pixel value is 2 bits of alpha (AA, 11
- full transparency, 00
- full opaque) and 2 bits of greyscale (luma) value (LL, 11
- white, 00
- black).
The origin of pixels in the file is upper-left corner (pixels fill from left-to-right, then top-to-bottom)
The last two bytes have to be 0xFFFF
Raw images are much simpler than RLE. It is a format only for square images (TODO: check if 240x240 or any square size) consisting of 2-bit greyscale pixels without an alpha channel. All 2-bits are packed into bytes starting from the highest bits in a byte. The origin of pixels is lower-right corner (pixels fill from right-to-left, then bottom-to-top).
For example for 4x4 image (if such is allowed) could have:
de ad be ef
to binary
11011110 10101101 10111110 11101111
to 2 bits
11 01 11 10 10 10 11 01 10 11 11 10 11 10 11 11
<- bottom right ..... top-left ->
so the image will look like this:
11 11 10 11
10 11 11 10
01 11 10 10
10 11 01 11
TODO