Skip site navigation (1)Skip section navigation (2)
Date:      12 Jan 1998 03:27:35 +0100
From:      dag-erli@ifi.uio.no (Dag-Erling Coidan Smørgrav)
To:        Mike Smith <mike@smith.net.au>
Cc:        Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>, hackers@FreeBSD.ORG
Subject:   Re: Splash screen (splashkit) for 3.0 systems...
Message-ID:  <xzpoh1ih1ew.fsf@hrotti.ifi.uio.no>
In-Reply-To: Mike Smith's message of "Wed, 07 Jan 1998 21:49:28 %2B1030"
References:  <199801071119.VAA00238@word.smith.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Mike Smith <mike@smith.net.au> writes:
> > > - A better image format.  The DIB (.BMP) format is relatively easy to
> > >   work with, but a 320x200x8 image runs the best part of 64k, which is
> > >   slow to load from floppy and wastes valuable core.
> > How about GIF?  
> Sure.  Do you have a compact decoder?  I'm more than aware of the 
> various formats around; as I said the *only* reason I used DIB was that 
> parsing it is so simple that even the Windows weenies can do it.

As a compromise, how about PCX version 5? You can write a PCX decoder
in ten lines of C, and although it does not compress nearly as well as
GIF, it is quite acceptable for 320x200x256. It also has the advantage
of not being burdened with a patent.

/*
 * Written off the top of my head - and untested :)
 *
 * src is a pointer to the PCX encoded image, dst is a pointer to some buffer
 * large enough to accomodate the decompressed image (e.g. video RAM)
 *
 * Note that it will not stop before decoding 64000 pixels, and assumes the
 * encoded image is "sane"
 */

void pcx_decode(unsigned char *src, unsigned char *dest)
{
    int pixels = 0, count;

    for (pixels = 0; pixels < 64000; src++)
        if ((src & 0xC0) == 0xC0)
            for (count = *(src++) & 0x3F; count; count--, dst++) *dst = *src;
        else *(dst++) = *src;
}

Of course, you still need to read the header and the palette, but
that's "easy as a piece of pie" ;) (remember to shift each byte in the
palette two bits to the right)

-- 
 * Finrod (INTJ) * Unix weenie * dag-erli@ifi.uio.no * cellular +47-92835919 *
  RFC1123: "Be liberal in what you accept, and conservative in what you send"
 # unzip ; strip ; touch ; finger ; mount ; fsck ; more ; yes ; umount ; sleep



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpoh1ih1ew.fsf>