Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpda!hp-sde!hpfcdc!hpldola!paul From: paul@hpldola.HP.COM (Paul Bame) Newsgroups: comp.graphics Subject: Re: Sun rasterfiles. Message-ID: <11390007@hpldola.HP.COM> Date: 2 May 88 19:08:26 GMT References: <1051@luth.luth.se> Organization: HP Elec. Design Div. -ColoSpgs Lines: 22 > >You can certainly write a RT_BYTE_ENCODED rasterfile pretty easy using the >appropriate pixrect routine. You have a pixrect and you dump it to a >rasterfile with pr_dump(). You can give the RT_BYTE_ENCODED option there. > I assume pixrect format is documented in the Sun manuals and I think it's used on the Mac as well. It's real simple and goes something like: control-byte,data-byte[s],control-byte,data-byte[s].... Where the control byte tells how to interpret the following data byte(s). If the sign bit is set (or clear? can't remember) then the number in the lower 7 bits tells how many times to repeat the value of the single following data byte. If the sign bit is the other way, the lower 7 bits tell how many data bytes follow - which should be copied verbatum to the output (this helps prevent 2x expansion on 01010101010 images). --Paul Bame hplabs!hpldola!paul hpldola!paul@hp-labs.csnet 719-590-5557