home *** CD-ROM | disk | FTP | other *** search
- /*
-
- Written by: Mark Krueger
-
- Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
-
- */
-
-
- #include <QuickDraw.h>
- #include "ImageCompression.h"
-
- #include "DrawTextCodec.h"
-
-
- /*
-
- decompress bheight strips ( of bwidth blocks ) of data. Each block is represented
- by one character of the font from compressed data. Font is assumed to be the same
- as that used in compression - ( font type style and size could be included in a header
- before the actual compressed data if we wanted to be truly flexible, but for a half-hour
- demo hack we dont wanna be)
-
- destination must be 1-bit/pixel.
-
- should be called in 32-bit mode.
-
- */
-
- long
- Decompress(unsigned char *baseAddr,short rowBytes,short bwidth,short bheight,char *dataPtr)
- {
-
- char *startDataPtr;
- unsigned char *rp,*bp;
- short i,x,y;
-
- startDataPtr = dataPtr; /* remember where we started from */
-
- TextSize(FONT_SIZE);
- TextFont(FONT_ID);
- for ( y=0; y < bheight; y++ ) {
- rp = baseAddr;
- for (x=0; x < bwidth; x++) {
- bp = rp;
- for ( i=0; i < FONT_HEIGHT; i++ ) {
- *bp = 0;
- bp += rowBytes;
- }
- MoveTo(x*FONT_WIDTH,BASE_LINE + y*FONT_HEIGHT);
- DrawChar(*dataPtr++);
- rp++;
- if ( x < bwidth ) {
- bp = rp;
- for ( i=0; i < FONT_HEIGHT; i++ ) {
- *bp = 0;
- bp += rowBytes;
- }
- }
- }
- baseAddr += rowBytes * FONT_HEIGHT;
- }
- return (dataPtr - startDataPtr);
-
-
- }
-
-
-
-
-