New version of PNG library (now v3.2.q)

User projects written in or related to FreeBASIC.
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Postby yetifoot » May 06, 2007 12:55

It should work fine in DOS, you don't need a full DJGPP for compiling it, you just need GNU Make, IIRC that is a seperate download on the DJGPP site, so you don't have to get the whole thing. You would also need a static version of zlib for DOS, i assume that is available somewhere on the web. Other than those, I don't see any reason why it would not work under DOS.
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Postby notthecheatr » Jul 12, 2007 23:42

Hey, I can't exactly understand this. Am I supposed to compile it into a DLL or can I just include it? I get an error when I try to compile the examples. I tried using makeall but make complained there was "nothing to make."
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Postby yetifoot » Jul 13, 2007 10:23

notthecheatr wrote:Hey, I can't exactly understand this. Am I supposed to compile it into a DLL or can I just include it? I get an error when I try to compile the examples. I tried using makeall but make complained there was "nothing to make."


Well, you could make a DLL if you wanted, but the main way it's set up to compile is as a static library.

I'm not sure what the problem with 'make all' was for you, I just tested it out from a clean download and it worked fine here.

Did you read the doc/readme.txt ?

you can use one of the prebuilt versions under build/ if you can't compile yourself.

Once compiled you will need two files, 'build/libfbpng.a' and 'inc/fbpng.bi'. These
should be placed either in your projects directory, or in the lib/ and inc/ dirs of your
FreeBASIC installation, along with the other libary and header files.


So for a simple usage you would just copy the build/prebuilt/<system>/libfbpng.a and inc/fbpng.bi to your projects directory, then in your program do #include "fbpng.bi" and #inclib "fbpng" and you should be able to start using it.
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Postby notthecheatr » Jul 16, 2007 22:32

Thanks, I figured out how to do it looking at other forum posts. I think I had some files in the wrong place.

Great library, by the way, it's just what I need!
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Postby yetifoot » Oct 13, 2007 14:38

*BUMP* New version, see first post for information.
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Postby notthecheatr » Oct 15, 2007 18:10

Bravo, this coincides with my writing an image-loading library... well most of the code for loading images is dependent upon other libraries (for example the PNG loading code is dependent upon fbpng) but it makes a consistent interface for loading any format supported.

I'm glad to see fbpng is not dead, this really should be added to the archive too.
lassar
Posts: 300
Joined: Jan 17, 2006 1:35
Contact:

Could you compile a static library for DOS ?

Postby lassar » Mar 31, 2008 8:12

I found a static library for windows and linux but no dos.

Could you compile a static library for DOS ?

I would appreciate it.
sir_mud
Posts: 1401
Joined: Jul 29, 2006 3:00
Location: US
Contact:

Postby sir_mud » Mar 31, 2008 14:33

if you have freebasic you can simply compile your own static lib with these commands:

Code: Select all

fbc -c src\*.bas
fbc -lib -x fbpng src\*.o


you will need zlib compiled for dos also (should be able to find a download link on this forum)
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Postby KristopherWindsor » Jul 18, 2008 8:21

I'll probably be using this library for my latest program. :-D

I've uploaded the simplest / smallest working FBPNG package / example, which uses this code to load a PNG image:

Code: Select all

#include once "fbgfx.bi"
#include once "png_image.bi"

Dim As fb.image Ptr g

Screenres 800, 600, 32

g = png_load("torus.png", PNG_TARGET_FBNEW)

Put (0, 0), g, Pset

Print g -> Width
Print g -> height

imagedestroy(g)

Sleep


http://freefile.kristopherw.us/uploads/ ... g-test.zip

So hopefully this will help people get started quickly using this lib. :-)

BTW, you can add error checking to the example; if g = 0 then it has not loaded. ;-)
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Postby yetifoot » Aug 26, 2008 0:32

I just had a report from nkk that many tests are failing when using the new 0.20.0 release.

After investigating, I have found that there is no problem with fbpng, just the test BMPs due to changes in the way BLOAD works.

You can read about that change here. (posts by DrV most informative)

http://freebasic.net/forum/viewtopic.php?t=11986

It appears that the change was reverted, so I probably won't change the tests at this point (next release I may look at this), but just let you know that fails in the tests is normal for the official 0.20.0 release, and it doesn't effect your use of PNG in any way.
counting_pine
Site Admin
Posts: 6169
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Postby counting_pine » Sep 27, 2008 14:52

Thinking back to the default target type issue, I'm thinking now that the best solution would be to have something dialect-dependent as the default:

Code: Select all

enum png_target_e
   PNG_TARGET_BAD
   PNG_TARGET_FBOLD
   PNG_TARGET_FBNEW
   PNG_TARGET_OPENGL
#if __FB_LANG__ = "fb"
   PNG_TARGET_LANG_DEFAULT = PNG_TARGET_FBNEW
#else
   PNG_TARGET_LANG_DEFAULT = PNG_TARGET_FBOLD
#endif
end enum
That should help compatibility for people who use lang fb and still want to rely on the image having the new-style header structure.
counting_pine
Site Admin
Posts: 6169
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Postby counting_pine » Oct 24, 2008 1:50

I noticed some recent changes in SVN to how images are created/destroyed... Does any of it affect your code?
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Postby yetifoot » Oct 24, 2008 23:19

counting_pine wrote:I noticed some recent changes in SVN to how images are created/destroyed... Does any of it affect your code?


No, because I allocate/destroy the buffers with malloc/free in fbpng, it won't effect it.

The only time those changes might burn someone as far as I can tell is if they mix the wrong functions, like callocate/imagedestroy, or imagecreate/free.
counting_pine
Site Admin
Posts: 6169
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Postby counting_pine » Oct 25, 2008 0:13

True, but if I didn't know better when using this library I'd choose imagedestroy by default, based on the fact that the function returns an FB-compatible image.

It's something to be wary of, with changes like this...
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Postby KristopherWindsor » Oct 25, 2008 1:20

counting_pine wrote:True, but if I didn't know better when using this library I'd choose imagedestroy by default, based on the fact that the function returns an FB-compatible image.


I did that in the example I posted above, and in my program, and have seen no errors. That was in .18.4, and I haven't tested much since installing .20.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 4 guests