[SDL] Re: Truetype vs bitmapped fonts? Opinions?

Frank J. Ramsay framsay at interactive.com
Tue Apr 11 13:11:22 PDT 2000


No, it's not RLE compression... the author of the book refers to it
as LLE compression.  I'll _try_ and explain it. 

If a scanline of the bitmap is:
- completely transparent just store a single '0' for it
- completely solid, store a 1 followed by the line data
- a mix of solid and transparent information store:
	- The number of 'runs' (a run being a series of either
	  solid pixels) + 1
	- then the decompressed offset of each run
	- then the length of each run.
	- then the data for the solid runs.
	(I don't remember how the transparent parts are
	 decoded, but it works)

So when it is blitted, if it the loop hits a '0' for the first byte 
of the line it just skips the line.  If it hits a '1' it just memcpy
the entire row.  If it his a number greater than 1, it blits each run
seperatly with a memcpy.
While this may sound slow, it's a lot faster than checking each 
pixel individually.


				-fjr

Kovacs wrote:
> 
> You mean RLE compression? I'm talking not about one transparency value for
> all surface, but about transparecy value for each non-color-keyed pixel,
> and i'm curios is this supported by hardware or must be written by hand.
> 
>         Kovacs
> 
> On Tue, 11 Apr 2000, Frank J. Ramsay wrote:
> 
> > Remember 16bpp color is the same (on the surface) as a Uint16, so you
> > can compare it to a Uin16 value.  However in the book, "Real Time
> > Stragegy Game Programming using MS DX6" there is a great example of how
> > to compress 16bpp sprite.  This method has a great feature of
> > compressing out transparent parts of the image.
> >
> >                               -fjr
> >
> >



More information about the SDL mailing list