Png load
Jump to navigation
Jump to search
Definition
INT png_load ( <STRING filename>, [ <POINTER id>] )
Creates a new graphic, using the specified PNG file as contents and puts it in the system file. Returns the graphID of the created graphic. The color depth of the created graphic will be the same as the loaded PNG file.
The previous name load_png() is deprecated.
Parameters
STRING filename | - The name of the PNG file to be loaded, including a possible path. |
POINTER id | - Optional parameter, for loading a map in the background. |
Returns
INT : graphID
-2 | - Waiting for the file to be loaded, see notes. |
-1 | - There was an error loading the file. |
>=0 | - The graphID of the newly created graphic. |
the following applies for versions prior rc282:
INT : graphID
0 | - There was an error loading the file. |
>0 | - The graphID of the newly created graphic. |
Notes
The optional parameter id was introduced in version rc282 and allows you to load resources in the background. It used with the Offset operator. See example below:
load_png("archivo_gordo.png", &idpng); while(idpng==-2) say("Big File Loading ...."); frame; end if(idpng==-1) say("Something went wrong!!"); exit(); // o return end say("Big file loaded ok!!");
Example
Checkout the PNG_LoadDirectory tutorial.