New version of PNG library (now v3.2.q)
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.
-
- Posts: 1759
- Joined: May 23, 2007 21:52
- Location: Cut Bank, MT
- Contact:
Well, you could make a DLL if you wanted, but the main way it's set up to compile is as a static library.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."
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.
-
- Posts: 1759
- Joined: May 23, 2007 21:52
- Location: Cut Bank, MT
- Contact:
-
- Posts: 1759
- Joined: May 23, 2007 21:52
- Location: Cut Bank, MT
- Contact:
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.
I'm glad to see fbpng is not dead, this really should be added to the archive too.
Could you compile a static library for DOS ?
I found a static library for windows and linux but no dos.
Could you compile a static library for DOS ?
I would appreciate it.
Could you compile a static library for DOS ?
I would appreciate it.
if you have freebasic you can simply compile your own static lib with these commands:
you will need zlib compiled for dos also (should be able to find a download link on this forum)
Code: Select all
fbc -c src\*.bas
fbc -lib -x fbpng src\*.o
-
- Posts: 2428
- Joined: Jul 19, 2006 19:17
- Location: Sunnyvale, CA
- Contact:
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:
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. ;-)
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
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. ;-)
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.
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.
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
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:
That should help compatibility for people who use lang fb and still want to rely on the image having the new-style header structure.
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
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
No, because I allocate/destroy the buffers with malloc/free in fbpng, it won't effect it.counting_pine wrote:I noticed some recent changes in SVN to how images are created/destroyed... Does any of it affect your code?
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.
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
-
- Posts: 2428
- Joined: Jul 19, 2006 19:17
- Location: Sunnyvale, CA
- Contact:
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.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.