Png save

From Bennu Wiki
Jump to navigation Jump to search


Definition

INT png_save ( <INT fileID> , <INT graphID> , <STRING filename> )

Saves the specified graphic as filename with the format PNG.

The previous name save_png() is deprecated.

Parameters

INT fileID - The fileID of the file that holds the graphic.
INT graphID - The graphID of the graphic to save.
STRING filename - The name of the PNG file to be saved, including a possible path.

Returns

INT : Successrate

false - Error.
true - Success.

Example

//here's a cool thing to save a screenshot
import "mod_map"
import "mod_screen"
import "mod_key"

Global
    int takingscreenshot;
End

Process Main()
Begin

    Loop
        
        If (key(_F12)) 
            If (takingscreenshot==0)
                takingscreenshot=1;
                graph=screen_get(); // grabs the screen and sets it as the program graphic
                png_save(0,graph,"shot"+rand(0,9999)+".png"); // saves the graphic as a png with a
                                                              // random number in the filename to
                                                              // prevent overwriting 
                map_unload(0,graph);  //frees the graphic
            Else
                takingscreenshot=0;
            End
            While(key(_F12)) Frame; End
       End

        frame;
    End
End

Used in example: key(), screen_get(), png_save(), map_unload()


Mod_map
Constants
B'"`UNIQ--nowiki-00000004-QINU`"'CLEARCHARSET'"`UNIQ--nowiki-00000004-QINU`"'CP850CHARSET'"`UNIQ--nowiki-00000004-QINU`"'ISO8859G'"`UNIQ--nowiki-00000004-QINU`"'ANIMATION'"`UNIQ--nowiki-00000004-QINU`"'SPEEDG'"`UNIQ--nowiki-00000004-QINU`"'ANIMATION'"`UNIQ--nowiki-00000004-QINU`"'STEPG'"`UNIQ--nowiki-00000004-QINU`"'ANIMATION'"`UNIQ--nowiki-00000004-QINU`"'STEPSG'"`UNIQ--nowiki-00000004-QINU`"'CENTER'"`UNIQ--nowiki-00000004-QINU`"'XG'"`UNIQ--nowiki-00000004-QINU`"'CENTER'"`UNIQ--nowiki-00000004-QINU`"'YG'"`UNIQ--nowiki-00000004-QINU`"'DEPTHG'"`UNIQ--nowiki-00000004-QINU`"'FRAMESG'"`UNIQ--nowiki-00000004-QINU`"'HEIGHTG'"`UNIQ--nowiki-00000004-QINU`"'PITCHG'"`UNIQ--nowiki-00000004-QINU`"'WIDEG'"`UNIQ--nowiki-00000004-QINU`"'WIDTHG'"`UNIQ--nowiki-00000004-QINU`"'X'"`UNIQ--nowiki-00000004-QINU`"'CENTERG'"`UNIQ--nowiki-00000004-QINU`"'Y'"`UNIQ--nowiki-00000004-QINU`"'CENTERNFB'"`UNIQ--nowiki-00000004-QINU`"'FIXEDWIDTHNFB'"`UNIQ--nowiki-00000004-QINU`"'VARIABLEWIDTH
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()