Macaw OS C reference

Function decodepicturefile

#include <macaw.h>
int decodepicturefile(
    const char *path,
    int maxw,
    int maxh,
    int background,
    int sprite,
    int *w,
    int *h
);

The same as decodepicture, but reads the PNG from a file.

Parameters

pathconst char *
The PNG file's path, from your program's folder unless it starts with /.
maxwint
The widest the picture can be, in pixels, or 0 for any width (up to 4096).
maxhint
The tallest the picture can be, in pixels, or 0 for any height (up to 4096).
backgroundint
The colour see-through parts are put on, as 0xRRGGBB, or -1 for white.
spriteint
1 for pixel art: no dithering, and see-through parts stay colour 0. 0 for a photo.
wint *
Where to put the PNG's own width before shrinking: pass the address of an int, like &w, or NULL.
hint *
Where to put the PNG's own height before shrinking: pass the address of an int, like &h, or NULL.

Returns int

The picture's number, or 0 if the file couldn't be read as a PNG.

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