@compress - Image Compression/Decompression Coders9/


NAME



1compress - Image Compression/Decompression Coders




(

SYNOPSIS



hunsigned int Huffman2DEncodeImage( ImageInfo *image_info, Image *image );

Ounsigned int HuffmanDecodeImage( Image *image );

lunsigned int HuffmanEncodeImage( const ImageInfo *image_info, Image *image );

lunsigned int LZWEncodeImage( Image *image, const unsigned int number_pixels, unsigned char*pixels );

qunsigned int PackbitsEncodeImage( Image *image, const unsigned int number_pixels, unsigned char*pixels );

Qunsigned int RunlengthDecodeImage( Image *image );

Qunsigned int RunlengthEncodeImage( Image *image );

/SetRunlengthEncoder( packet );

7SetRunlengthPackets( image, packets );

sunsigned int ZLIBEncodeImage( Image *image, const unsigned long number_pixels, const unsigned int.quality, unsigned char *pixels );




B

FUNCTION DESCRIPTIONS






2

ASCII85Encode



%Method ASCII85Encode encodes data in +ASCII base-85 format. :ASCII base-85 encoding produces five TASCII printing characters from every four bytes of binary data.

*The format of the ASCII85Encode method is:

%

    void Ascii85Initialize(void)


=A description of each parameter follows:

6

code:


$a binary unsigned char to encode to ASCII 85.!

file:


write the encoded 2ASCII character to this file.






<

HuffmanDecodeImage



CMethod HuffmanDecodeImage uncompresses an image via Huffman-coding.

/The format of the HuffmanDecodeImage method is:j

unsigned int HuffmanDecodeImage ( Image *image );


=A description of each parameter follows:

#

status:


GMethod HuffmanDecodeImage returns True if all the pixels are compressedwithout error, otherwise False."

image:


)The address of a structure of type Image.






<

HuffmanEncodeImage



AMethod HuffmanEncodeImage compresses an image via Huffman-coding.

/The format of the HuffmanEncodeImage method is:ª

unsigned int HuffmanEncodeImage ( const ImageInfo *image_info, Image *image );


=A description of each parameter follows:

#

status:


GMethod HuffmanEncodeImage returns True if all the pixels are compressedwithout error, otherwise False.'

image_info:


.Specifies a pointer to an ImageInfo structure."

image:


)The address of a structure of type Image.






@

Huffman2DEncodeImage



CMethod Huffman2DEncodeImage compresses an image via two-dimensionalHuffman-coding.

1The format of the Huffman2DEncodeImage method is:¦

unsigned int Huffman2DEncodeImage ( ImageInfo *image_info, Image *image );


=A description of each parameter follows:

#

status:


IMethod Huffman2DEncodeImage returns True if all the pixels are compressedwithout error, otherwise False.'

image_info:


.Specifies a pointer to an ImageInfo structure."

image:


)The address of a structure of type Image.






4

LZWEncodeImage



VMethod LZWEncodeImage compresses an image via LZW-coding specific to Postscript Level WII or Portable Document Format. To ensure portability, the binary .LZW bytes are encoded as #ASCII base-85.

+The format of the LZWEncodeImage method is:Ÿ

unsigned int LZWEncodeImage ( Image *image, const unsigned int number_pixels, unsigned char *pixels );


=A description of each parameter follows:

#

status:


KMethod LZWEncodeImage returns True if all the pixels are compressed withouterror, otherwise False."

image:


)The address of a structure of type Image.*

number_pixels:


EAn unsigned interger that specifies the number of pixels to compress.#

pixels:


GThe address of an unsigned array of characters containing the pixels to compress.






>

PackbitsEncodeImage



lMethod PackbitsEncodeImage compresses an image via Macintosh Packbits encoding specific to Postscript Level uII or Portable Document Format. To ensure portability, the binary Packbits bytes are encoded as #ASCII Base-85.

0The format of the PackbitsEncodeImage method is:¤

unsigned int PackbitsEncodeImage ( Image *image, const unsigned int number_pixels, unsigned char *pixels );


=A description of each parameter follows:

#

status:


HMethod PackbitsEncodeImage returns True if all the pixels are compressedwithout error, otherwise False."

image:


)The address of a structure of type Image.*

number_pixels:


DAn unsigned integer that specifies the number of pixels to compress.#

pixels:


GThe address of an unsigned array of characters containing the pixels to compress.






@

RunlengthDecodeImage



@Method RunlengthDecodeImage unpacks the packed image pixels intoFrunlength-encoded pixel packets. The packed image pixel memory is thenfreed.

1The format of the RunlengthDecodeImage method is:l

unsigned int RunlengthDecodeImage ( Image *image );


=A description of each parameter follows:

#

status:


IMethod RunlengthDecodeImage return True if the image is decoded. False is%returned if there is an error occurs."

image:


)The address of a structure of type Image.






@

RunlengthEncodeImage



JMethod RunlengthEncodeImage packs the runlength-encoded pixel packets intothe minimum number of bytes.

1The format of the RunlengthEncodeImage method is:l

unsigned int RunlengthEncodeImage ( Image *image );


=A description of each parameter follows:

#

status:


JMethod RunlengthEncodeImage return the number of bytes the image consumes.$Zero is returned if an error occurs."

image:


)The address of a structure of type Image.






>

SetRunlengthEncoder



=Method SetRunlengthEncoder initializes the runlength encoder.

2The format of the SetRunlengthEncoder function is:9

SetRunlengthEncoder ( packet );


=A description of each parameter follows:

#

packet:


!Specifies a RunlengthPacket type.






>

SetRunlengthPackets



=Method SetRunlengthPackets initializes the runlength encoder.

2The format of the SetRunlengthPackets function is:A

SetRunlengthPackets ( image, packets );


=A description of each parameter follows:

"

image:


)The address of a structure of type Image.$

packets:


The number of runlength packets.






6

ZLIBEncodeImage



XMethod ZLIBEncodeImage compresses an image via ZLIB-coding specific to Postscript Level WII or Portable Document Format. To ensure portability, the binary /ZLIB bytes are encoded as #ASCII base-85.

,The format of the ZLIBEncodeImage method is:½

unsigned int ZLIBEncodeImage ( Image *image, const unsigned long number_pixels, const unsigned int quality, unsigned char *pixels );


=A description of each parameter follows:

#

status:


DMethod ZLIBEncodeImage returns True if all the pixels are compressedwithout error, otherwise False.!

file:


#The address of a structure of type FILE. BZLIB encoded pixels are written to this file.*

number_pixels:


DAn unsigned integer that specifies the number of pixels to compress.$

quality:


the compression level (0-100).#

pixels:


GThe address of an unsigned array of characters containing the pixels to compress.