Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: psygate on December 29, 2006

Title: Loading PNG into Imagebuffer
Post by: psygate on December 29, 2006
Good Evening!

I have a little problem. I really need your help because I'd like to load an .png image into an imagebuffer which I have declared in my program, but I don't know anything about the format of png files nor about libraries which could help me... So could someone from this forum help me to realize what I want? PLZ
Title: Re: Loading PNG into Imagebuffer
Post by: Jim on December 29, 2006
You're talking about freebasic?   ImageBuffers are Blitz.

You want libpng which comes pre-made with freebasic.
Look in the examples folder inside freebasic, and in the gfx folder there's an example called png_read.bas
Everything you need is in there.

Jim
Title: Re: Loading PNG into Imagebuffer
Post by: psygate on December 29, 2006
tHX!

BDW: imagebuffers are also freebasic! jsut look at the reference under "createimage() and destroyimage()"
Title: Re: Loading PNG into Imagebuffer
Post by: Clyde on January 02, 2007
Cool question and something I've wanted to investigate for tinyptc.
I've not yet looked at the examples for this, does anyone know if LibPng utilizes the GFXLib command set?

Cheers,
Clyde.
Title: Re: Loading PNG into Imagebuffer
Post by: TbbW on January 05, 2007
or use the Pload lib... its a static lib.
Pload() freebasic.net (http://www.freebasic.net/forum/viewtopic.php?t=4033&highlight=pload)
same if you get the zlib static lib for fb ( can be found on the fb forum )

it works werry simple:

dim picbuffer as any ptr
picbuffer = pload("filename.png")
Title: Re: Loading PNG into Imagebuffer
Post by: Jim on January 05, 2007
Thanks TbbW, welcome to the forums!

Jim
Title: Re: Loading PNG into Imagebuffer
Post by: Shockwave on January 05, 2007
Yep,  :hi: Hope you stick around!
Title: Re: Loading PNG into Imagebuffer
Post by: TbbW on January 07, 2007
thanks  :cheers: