[Coco] Compressed pictures

Roger Taylor operator at coco3.com
Sat Apr 28 19:18:15 EDT 2007


At 03:44 PM 4/28/2007, you wrote:
>While writing some of my BASIC programs, I thought about adding a 
>intro screen.
>The options were add the drawing commands to the program (slow, 
>limited) or load a graphic screen.
>But even a PMODE 3 screen is 6Kb, a bit to much for a 2 Kb program
>So I came up with a very simple compression rutine. 2 bit for color, 
>6 bits for how many pixels of that color. Some sample simple screens 
>came down to just under 1 Kb (I know that some complex screens can 
>become a lot larger than the original)
>My question: Is there some format/way to get a screen picture+loader 
>in less than 2 Kb thatls already out there somewhere?
>
>Diego

Diego, look at the Projector-3 project that comes with the Rainbow 
IDE.  It includes many picture codec modules.  There's a 2-color RLE 
(run-length encoded) driver which does away with the color portion 
and just alternates Black/White count values for the picture 
content.  Each byte in the stream tells the decoder to change to the 
other color and output that many colors.  I'm foggy on that format 
after all these years but I think a count value of #0 or #1 means to 
keep the same color, but I'm not totally sure.

The ColorMax Deluxe format (.MGE) uses the COUNT, BYTE method to 
compress the raster lines.  I found that in low detail pictures, this 
is much better than doing COUNT, *COLOR*, even if you use a 4-bit 
stream since colors are never over 16 and can be held in 4 bits.  The 
count would be limited to 4 bits as well which is why the format 
doesn't work as good as MGE in most cases I tried.

The drivers for Projector-3 are isolated and reusable to some 
degree.  They include READ and WRITE calls for getting file data, 
screen data, or writing the same, but you'll have to know more about 
P-3 in order to use these as modules in your own program.

I'd just reuse the source code and replace the calls to the P-3 core 
with your own calls for file and screen I/O.





-- 
Roger Taylor




More information about the Coco mailing list