Nick Bowler [Tue, 9 Feb 2010 05:27:30 +0000 (00:27 -0500)]
liblbx: Add support for "chunked" images.
It appears that the frame count fields aren't actually two 16-bit
fields, but rather four 8-bit fields. The images in monster.lbx
appear to have "chunks" of animation and what was previously thought to
be the most significant byte of the lead-in now seems to be the length
of a "chunk".
These images are much like any other, except that the first frame of
every chunk is drawn on a clean slate. Examples are found in
monster.lbx.
Nick Bowler [Tue, 9 Feb 2010 04:14:16 +0000 (23:14 -0500)]
liblbx: Add support for "raw" LBX images.
There is a new image format in town. If a particular flag bit is set,
then there are no row headers and data for every pixel of a frame is
simply stored in row-major order. An example of such an image is
starbg.lbx.009, as well as several others in the same archive.
Don't you just *love* the designers of this format?
Nick Bowler [Mon, 8 Feb 2010 04:24:06 +0000 (23:24 -0500)]
liblbx: Add new flag.
Building images have a previously-unknown flag, 0x0800. The images have
a part that looks like a shadow, but it does not have any palette entry.
I suspect that this flag is related to that shadow.
Nick Bowler [Sun, 7 Feb 2010 22:11:26 +0000 (17:11 -0500)]
liblbx: Add a field to lbx_colour indicating which entries are used.
An LBX palette might not contain values for all 256 entries. Currently,
there is no way to tell which entries were assigned when the palette is
retrieved from an image. This patch adds an extra marker which can be
used to skip over unused palette entries.
Nick Bowler [Thu, 4 Feb 2010 19:02:44 +0000 (14:02 -0500)]
lbxtool: Remove - as a synonym for stdin.
Modern Unix-like systems have interfaces such as /dev/stdin which mean
the same thing. Furthermore, the tools read from stdin by default.
Lastly, -f some_file -f - doesn't work anyway.
Nick Bowler [Thu, 4 Feb 2010 16:47:18 +0000 (11:47 -0500)]
liblbx: Don't ignore whence parameter in pipe_seek.
The code from which this derived only supported SEEK_SET-like
operations, so SEEK_CUR was forgotten when converting it.
SEEK_END obviously cannot be supported on pipes.
Nick Bowler [Thu, 4 Feb 2010 05:07:20 +0000 (00:07 -0500)]
build: Don't use a semicolon after sed's 't' command.
Some (namely, FreeBSD's) sed implementations fail when a semicolon is
used after a 't' command. This behaviour appears to be acceptable
according to POSIX, so appease these implementations.
Nick Bowler [Thu, 4 Feb 2010 01:47:40 +0000 (20:47 -0500)]
liblbx: Parameterise I/O functions to allow custom streams.
This eliminates the need for lbx_mopen and friends, so remove them. We
also now leave it to the caller to handle "seeking" on pipes, to
eliminate yet another hack. Only the core LBX handling code is updated
for now.
Nick Bowler [Wed, 3 Feb 2010 20:13:06 +0000 (15:13 -0500)]
test: Fix up regression test script.
The script uses a hodge-podge of portable and non-portable constructs
and declares the interpreter as /bin/sh. Change it to use my favourite
shell and exploit its features.
Nick Bowler [Fri, 4 Jan 2008 10:52:55 +0000 (05:52 -0500)]
Implement image masks to handle transparency in images.
This makes a whole bootload of images work properly.
LBX doesn't translate nicely to PNG when there are transparent pixels.
Therefore, lbximg will use 256-colour paletted PNG when there are no such
pixels, and 32-bit RGBA PNG when there is at least one such pixel. This choice
is mainly because working with 32-bit RGBA PNGs takes forever on my laptop.
Apparently the simtex logo image contains some transparent pixels, thus the
regression test has been suitably updated.
Nick Bowler [Fri, 4 Jan 2008 07:48:19 +0000 (02:48 -0500)]
Implement new handling of the LBX image header data.
* Change "#offsets" to "#frames". This makes lbximg capable of decoding all
frames of images such as the TANM_ family and science.lbx.001
* Change interpretation of "pal" to a bitmask containing flags. Current flags
handled are
- 0x0400: render each frame on a blank slate (makes TANM_ family work).
- 0x1000: image contains embedded palette, as previously understood.
- 0x2000: image loops over all frames.
* Change interpretation of previously-thought "#frames" to "leadin" - that is,
indicates the first frame that is part of a looping animation. This is
superseded by flag 0x2000, and yes - leadin == 0 means the same thing as that
flag. This will allow science.lbx.001 to be looped correctly. This leads to
the somewhat strange notion that all images loop, just that some simply loop
over the last frame.
Also update lbx_getinfo() to reflect the new information.
Nick Bowler [Mon, 31 Dec 2007 10:24:40 +0000 (05:24 -0500)]
Update handling of embedded palette data in image files.
The pal (formerly wtf2) value indicates the presence of a palette: 0x1000 if
present; 0 otherwise. Then, immediately following the offsets comes the
palette header: 2 bytes always zero, 2 bytes for the number of entries.
Entries are sequential starting from zero.
Nick Bowler [Mon, 31 Dec 2007 09:40:18 +0000 (04:40 -0500)]
Fixes to image processing.
The noffsets and nframes values stored in image files appear to be one less
than what they actually are, so increment them on load. This makes single
frame images work.
If the xval read on a 'type 0' row command is 1000, stop processing the frame.
This makes the 50th frame of mainmenu.lbx.000 work.