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

User contributed sources that have become inactive, deprecated, or generally unusable. But ... we don't really want to throw them away either.
Post Reply
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

No go. I get this error...

Image

-Vince
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Post by KristopherWindsor »

Maybe you already have the DLL and don't want it, but if anyone does want it:
http://freefile.kristopherw.us/uploads/ ... /zlib1.dll
:)
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

So does this mean that I cannot statically link the library? What is the purpose of #define PNG_STATICZ 1?

-Vince
1000101
Posts: 2556
Joined: Jun 13, 2005 23:14
Location: SK, Canada

Post by 1000101 »

You can statically link the the png library, but without specifying that it will still link to zlib.dll instead of the static zlib.
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

1000101 wrote:You can statically link the the png library, but without specifying that it will still link to zlib.dll instead of the static zlib.
So why am I getting that error message??!!! This is really getting confusing! :(

-Vince
1000101
Posts: 2556
Joined: Jun 13, 2005 23:14
Location: SK, Canada

Post by 1000101 »

Bug in the png source?
GuideBot
Posts: 4
Joined: Aug 18, 2008 23:52

Post by GuideBot »

Newer versions of freebasic come with an old version of the PNG lib already included and the compiler uses those versions in preference to the ones in your project code - you may need to overwrite the existing ones with the newer version or just delete it from the library and inc folders so that the compiler is forced to use the ones in the project directory.
Imortis
Moderator
Posts: 1923
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Post by Imortis »

That is not 100% true. A few versions ago on the WIN32 SVN I forgot that I had installed PNG lib in my FB directory. I had installed a version that was on my thumbdrive, and it was VERY old. I was informed of this, and updated the version I had in my directory, so the newest SVN downloads I provide have the latest version of the LIB.I would remove it, but I have not yet found a SIMPLE way to still use the LIB without it being in my FB directories. If anyone can give me a hint, I will remove it all together from the SVN downloads to make things simpler.
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Post by KristopherWindsor »

Imortis wrote:That is not 100% true. A few versions ago on the WIN32 SVN I forgot that I had installed PNG lib in my FB directory. I had installed a version that was on my thumbdrive, and it was VERY old. I was informed of this, and updated the version I had in my directory, so the newest SVN downloads I provide have the latest version of the LIB.I would remove it, but I have not yet found a SIMPLE way to still use the LIB without it being in my FB directories. If anyone can give me a hint, I will remove it all together from the SVN downloads to make things simpler.
You can put the .a file and DLL in the project folder, as with any other library. If you put the .a file in a subfolder of your project folder, you can use #libpath.
GuideBot
Posts: 4
Joined: Aug 18, 2008 23:52

Post by GuideBot »

Imortis wrote:That is not 100% true. A few versions ago on the WIN32 SVN I forgot that I had installed PNG lib in my FB directory. I had installed a version that was on my thumbdrive, and it was VERY old. I was informed of this, and updated the version I had in my directory, so the newest SVN downloads I provide have the latest version of the LIB.I would remove it, but I have not yet found a SIMPLE way to still use the LIB without it being in my FB directories. If anyone can give me a hint, I will remove it all together from the SVN downloads to make things simpler.
Hey, didn't mean to impugn your builds, I appreciate them very much! =P Allow me to correct myself, then! Since the standalone version of pnglib is different to the regular version that is included in your build the compiler will by default use the .dll dependent version included with freebasic rather than the standalone version in the project directory. At least - that's my experience.

In regards to using pnglib outside of your FB directory, I've honestly never had any trouble with just putting

Code: Select all

#define PNG_STATICZ 1
#include Once "fbpng.bi"
near the top of my main .bas file and the libfbpng.a and png_image.bi files in the same directory - seems to work OK. What error do you get?
Imortis
Moderator
Posts: 1923
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Post by Imortis »

KristopherWindsor hit the nail on the head. I will have pnglib removed from the next release.
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

Q: How do I assign a color scheme to a 1 bit png image?
dreamerman
Posts: 12
Joined: Jul 01, 2007 20:17
Location: Poland

Post by dreamerman »

I think that there is an error in png_dimensions function's.

Code: Select all

#include "file.bi"
#Include "fbpng.bi"

Dim As UInteger xu, yu, czi

For czi = 1 To 1000
png_dimensions(ExePath & "\test.PNG", xu, yu)
If Not FileExists(ExePath & "\test.PNG") Then Print czi & " - error!": Exit For
Next
Error will appear when czi will be 509 or something around.
That's because png file should be closed after successfully read of dimensions.
Now png_dimensions look like this:

Code: Select all

w = get_u32( @tmp1 )
h = get_u32( @tmp2 )
end sub
But it should like this:

Code: Select all

w = get_u32( @tmp1 )
h = get_u32( @tmp2 )
fclose( hfile )
end sub
Strange I can't write PM :>
ps. great library :-)
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Post by yetifoot »

Thanks dreamerman, yes that is a bug, I will update the code in the next version.
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Post by yetifoot »

First post updated with new version v1.9.3
Post Reply