GCGlib  0.04.228
GCG Graphics Engine
Bitmap image Run-Length Encoding

Functions

unsigned int gcgCompressImageRLE8 (unsigned int width, unsigned int height, unsigned char *srcdata, unsigned char *RLEdata)
 Compress a 8 bit bitmap image as a Run-Lenght Encoded block. More...
 
unsigned int gcgDecompressImageRLE8 (unsigned int width, unsigned int height, unsigned char *RLEdata, unsigned char *dstdata)
 Decompress a bit Run-Length Encoded 8 bits bitmap image. It receives a compressed block of a Windows .bmp image or the result of the compression with gcgCompressImageRLE8(). More...
 
unsigned int gcgDecompressImageRLE4 (unsigned int width, unsigned int height, unsigned char *RLEdata, unsigned char *dstdata)
 Decompress a bit Run-Length Encoded 4 bits bitmap image. It receives a compressed block of a Windows .bmp image. More...
 

Detailed Description

GCGlib provides functions for encoding/decoding image bitmaps (Windows .bmp standard) using RLE.

Function Documentation

◆ gcgCompressImageRLE8()

unsigned int gcgCompressImageRLE8 ( unsigned int  width,
unsigned int  height,
unsigned char *  srcdata,
unsigned char *  RLEdata 
)

Compress a 8 bit bitmap image as a Run-Lenght Encoded block.

Parameters
[in]widthnumber of columns of the image to be compressed.
[in]heightnumber of rows of the image to be compressed.
[in]srcdatapointer to the 8 bits bitmap image to be compressed.
[out]RLEdatapointer to a buffer that has, at least, the same size of the source bitmap image. This buffer receives the compressed data if the compressed version is smaller than the original image, taking into account a number of columns multiple of four. It might be changed even if the original data is smaller than the compressed version.
Returns
returns the size in bytes of the compressed image or 0, if the compressed version is greater than original data.
See also
gcgDecompressImageRLE4
gcgDecompressImageRLE8
Since
0.01.6

◆ gcgDecompressImageRLE4()

unsigned int gcgDecompressImageRLE4 ( unsigned int  width,
unsigned int  height,
unsigned char *  RLEdata,
unsigned char *  dstdata 
)

Decompress a bit Run-Length Encoded 4 bits bitmap image. It receives a compressed block of a Windows .bmp image.

Parameters
[in]widthnumber of columns of the image to be decompressed.
[in]heightnumber of rows of the image to be decompressed.
[in]RLEdatapointer to the first byte of the data, obtained from a Windows .bmp 4 bits image.
[out]dstdatapointer to a buffer that has, at least, the same size in bytes of the uncompressed image, taking into account an image row size multiple of four bytes.
Returns
the size in bytes of the uncompressed image or 0, if an error occurs during the decompression.
See also
gcgDecompressImageRLE8
Since
0.01.6

◆ gcgDecompressImageRLE8()

unsigned int gcgDecompressImageRLE8 ( unsigned int  width,
unsigned int  height,
unsigned char *  RLEdata,
unsigned char *  dstdata 
)

Decompress a bit Run-Length Encoded 8 bits bitmap image. It receives a compressed block of a Windows .bmp image or the result of the compression with gcgCompressImageRLE8().

Parameters
[in]widthnumber of columns of the image to be decompressed.
[in]heightnumber of rows of the image to be decompressed.
[in]RLEdatapointer to the first byte of the data, compressed using gcgCompressImageRLE8() or obtained from a Windows .bmp 8 bits image.
[out]dstdatapointer to a buffer that has, at least, the same size in bytes of the uncompressed image, taking into account an image row size multiple of four bytes.
Returns
the size in bytes of the uncompressed image or 0, if an error occurs during the decompression.
See also
gcgCompressImageRLE8
gcgDecompressImageRLE4
Since
0.01.6