Png load

From Bennu Wiki
Jump to: navigation, 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.


Mod_map
Globals None
Imported:
FullscreenGraphmodeM7ScalemodeScaleresolutionScaleresolutionaspectratioScaleresolutionorientation
Constants BCLEARCHARSETCP850CHARSETISO8859GANIMATIONSPEEDGANIMATIONSTEPGANIMATIONSTEPSGCENTERXGCENTERYGDEPTHGFRAMESGHEIGHTGPITCHGWIDEGWIDTHGXCENTERGYCENTERNFBFIXEDWIDTHNFBVARIABLEWIDTH
Imported:
BABLENDBALPHABHMIRRORBNOCOLORKEYBSBLENDBTRANSLUCENTBVMIRRORDOUBLEBUFFERHWSURFACEM1024X768M1280X1024M320X200M320X240M320X400M360X240M376X282M400X300M512X384M640X400M640X480M800X600MODE16BITSMODE16BPPMODE2XSCALEMODE8BITSMODE8BPPMODEDOUBLEBUFFERMODEFRAMELESSMODEFULLSCREENMODEHARDWAREMODEMODALMODEWAITVSYNCMODEWINDOW
Functions Bdfload()Centerset()Colorfind()Colorsget()Colorsset()Fade()Fadeoff()Fadeon()Fntload()Fntnew()Fntsave()Fntunload()Fpgadd()Fpgdel()Fpgexists()Fpgload()Fpgnew()Fpgsave()Fpgunload()Getpixel()Glyphget()Glyphset()Graphicinfo()Graphicset()Mapblockcopy()Mapbuffer()Mapclear()Mapclone()Mapdel()Mapexists()Mapgetpixel()Mapinfo()Mapinfoget()Mapinfoset()Mapload()Mapname()Mapnew()Mapput()Mapputpixel()Mapsave()Mapsetname()Mapunload()Mapxput()Mapxputnp()Palclone()Paldel()Palget()Palload()Palmapassign()Palmapgetid()Palmapremove()Palnew()Palrefresh()Palsave()Palset()Palunload()Paletteconvert()Paletteroll()Pcxload()Pngload()Pngsave()Pointget()Pointset()Putpixel()Rgb()Rgbget()Rgba()Rgbaget()