Table of Contents


MAGReaderNextPixel - initializes MAG image reader


#include <maglo.h>
int MAGReaderNextPixel(MagReader *rd, unsigned char *buf);


The MAGReaderNextPixel() function copies next MAG pixel from MagReader rd to buf if one is available.

A MAG pixel consists of 2 or 4 screen pixels, which can be queried to the library with MAGpixelWidth() function. The buf should be 2 or 4 bytes long depending on the width of MAG pixel of the image.

After successful completion, the buf contains palette indexes for each of two or four screen pixels. The mapping between palette index and actual color can be queried through MAGpalette() function.

If the image width is not multiple of 2 or 4, dummy screen pixels are padded at the end of each row.

Return Values

On successful completion MAGReaderNextPixel function returns MAGERR_NOERROR. Otherwise one of following error codes is returned:

All the image data is transferred.
The image data is corrupt.
The image data is truncated.

See Also

MAGReader(3) , MAGpixelWidth(3) , MAGimageWidth(3) , MAGpalette(3) , libmaglo(7)

Table of Contents