FreeImage.dll Problem

BlitzPlus Forums/BlitzPlus Programming/FreeImage.dll Problem

CASO(Posted 2006) [#1]
I found a problem in the decl file but fixed it. It now finds the userlib but it wont work. Here is the code I am using:

Graphics 500,500,32,2
pic=LoadImage("graphics\player2.bmp")
pic2=FI_AdjustGamma(pic,50)
Notify pic2
DrawImage pic,0,0
;DrawImage pic2,0,0
Flip
Delay 2000

It notifys me "0" showing it was unsuccessful. Then pulls up this REALLY long error that it said occured with blitzcc. I don't know what the problem is.

PS: WolRon is this forum where this belongs?


WolRon(Posted 2006) [#2]
If the code compiles and executes, then (I BELIEVE) that that means that your code is written correctly (as far as accessing the external function is concerned).

When loading outside media, you should always verify that the loading function worked correctly. In your example code above, you could do so by writing it this way:
Graphics 500,500,32,2
pic=LoadImage("graphics\player2.bmp")
If pic = 0 Then RunTimeError("Error: pic did not successfully load!")
pic2=FI_AdjustGamma(pic,50)
If pic2 = 0 Then RunTimeError("Error: pic2 did not successfully load!")
DrawImage pic,0,0
;DrawImage pic2,0,0
Flip
WaitKey()
End
Since pic2 isn't successfully being loaded (=0) then I would GUESS that your problem is the fact that you are passing the FI_AdjustGamma function a Blitz image handle (pic) and not an actual filename ("graphics\player2.bmp"). The reason I don't know for sure, is because I didn't write the FI_AdjustGamma function and I don't know the correct usage of it.

Posting the .decl file you made for it may help us resolve the problem but if we can't resolve it with that information, you will most likely have to contact the .dll writer to ask for specific instructions on how to use their code. Because if the problem truly is the FI_AdjustGamma function, then no one here can probably help you with that.


CASO(Posted 2006) [#3]
I am just going to give up because all things seem to point to a bad dll.

By the way how do you get code to appear like that on the site?


WolRon(Posted 2006) [#4]
What are the forum codes?


CASO(Posted 2006) [#5]
Thanks WolRon


ralphy(Posted 2006) [#6]
The example bb exe based on the freeimage dll, but his sample source code won't complie as the dll calls referenced arnt declared. How do you reference all the functions in the dll in B+?


ralphy(Posted 2006) [#7]
Oops should say:
The example bb exe works ok using the freeimage dll.
The sample source code won't compile as the dll calls aren't referenced. How do you reference all the functions in the dll using B+?


ralphy(Posted 2006) [#8]
Ignore previous post, I found a decls file to place in userlibs folder.