graphics/ png.bi

Summary
graphics/ png.bi
LicenseCopyright © 2009, FreeBASIC Extended Library Development Group
ext. gfx.png
Enumerations
target_eContains the valid destinations/locations for the png image.
Functions
loadLoads a png file.
load_memLoads a png file that has been located in memory.
saveSaves a png image from a memory buffer.
dimensionsGets the dimensions of a png image without loading it.
dimensions_memGets the dimensions of a png file loaded in memory.

License

Copyright © 2009, FreeBASIC Extended Library Development Group

Contains code contributed and copyright © 2007 yetifoot

Distributed under the FreeBASIC Extended Library Group license.  See accompanying file LICENSE.txt or copy at http://code.google.com- /p- /fb-extended-lib- /wiki- /License

ext. gfx.png

Summary
Enumerations
target_eContains the valid destinations/locations for the png image.
Functions
loadLoads a png file.
load_memLoads a png file that has been located in memory.
saveSaves a png image from a memory buffer.
dimensionsGets the dimensions of a png image without loading it.
dimensions_memGets the dimensions of a png file loaded in memory.

Enumerations

target_e

Contains the valid destinations/locations for the png image.

TARGET_BADinvalid
TARGET_FBNEWuse the new (.17 and up) style graphics buffer.
TARGET_OPENGLuse an OpenGL compatible buffer.

Functions

load

declare function load cdecl alias "png_load" (
   byref filename as const string,  
   byval target as target_e =  TARGET_FBNEW
) as any ptr

Loads a png file.

Parameters

filenamethe png image to load.
target(optional) the target from target_e to load to, defaults to New FB style Image buffer

Returns

Pointer to png image in memory.

Notes

When destroying an image created with TARGET_OPENGL you must use deallocate, not imagedestroy.

load_mem

declare function load_mem cdecl alias "png_load_mem" (
   byval buffer as any ptr,
   byval buffer_len as integer,
   byval target as target_e
) as any ptr

Loads a png file that has been located in memory.

Parameters

bufferpointer to memory buffer holding the file.
buffer_lenthe length of the buffer.
targetthe target from target_e to load to.

Returns

Pointer to png image in memory.

save

declare function save cdecl alias "png_save" (
   byref filename as const string,
   byval img as const FB.IMAGE ptr
) as integer

Saves a png image from a memory buffer.

Parameters

filenamethe file to save as.
imgthe FBGFX buffer to save.

Returns

Success.

dimensions

declare sub dimensions cdecl alias "png_dimensions" (
   byref filename as const string,
   byref w as uinteger,
   byref h as uinteger
)

Gets the dimensions of a png image without loading it.

Parameters

filenamethe file to get the dimensions of.
wwill contain the width of the image.
hwill contain the height of the image.

dimensions_mem

declare sub dimensions_mem cdecl alias "png_dimensions_mem" (
   byval buffer as const any ptr,
   byref w as uinteger,
   byref h as uinteger
)

Gets the dimensions of a png file loaded in memory.

Parameters

bufferpointer to the memory buffer holding the file.
wwill contain the width.
hwill contain the height.
declare function load cdecl alias "png_load" (
   byref filename as const string,  
   byval target as target_e =  TARGET_FBNEW
) as any ptr
Loads a png file.
declare function load_mem cdecl alias "png_load_mem" (
   byval buffer as any ptr,
   byval buffer_len as integer,
   byval target as target_e
) as any ptr
Loads a png file that has been located in memory.
declare function save cdecl alias "png_save" (
   byref filename as const string,
   byval img as const FB.IMAGE ptr
) as integer
Saves a png image from a memory buffer.
declare sub dimensions cdecl alias "png_dimensions" (
   byref filename as const string,
   byref w as uinteger,
   byref h as uinteger
)
Gets the dimensions of a png image without loading it.
declare sub dimensions_mem cdecl alias "png_dimensions_mem" (
   byval buffer as const any ptr,
   byref w as uinteger,
   byref h as uinteger
)
Gets the dimensions of a png file loaded in memory.