Macaw OS C reference

Function importpicture

#include <macaw.h>
int importpicture(
    const void *png,
    int n,
    int maxw,
    int maxh,
    int *w,
    int *h
);

Brings in a PNG made elsewhere, ready for editing: each pixel becomes the nearest of the 256 colours, and see-through parts become colour 0. It's made smaller only if it doesn't fit.

Parameters

pngconst void *
Where the PNG's bytes are.
nint
How many bytes there are.
maxwint
The widest the picture can be, in pixels, or 0 for 256.
maxhint
The tallest the picture can be, in pixels, or 0 for 256.
wint *
Where to put the PNG's own width: pass the address of an int, like &w, or NULL.
hint *
Where to put the PNG's own height: pass the address of an int, like &h, or NULL.

Returns int

The picture's number, or 0 if the data isn't a PNG it can read.

In Pictures, with newpicture, loadpicture, freepicture, picturewidth, pictureheight, drawpicture, drawpart, drawinto, drawpictureex, drawpartex, savepicture, parsepicture, decodepicture, decodepicturefile, importpicturefile, pictureget, pictureset, picturesize, pictureclear, picturecopy, picturegetrgb, picturesetrgb.