FreeImage incbin problem

BlitzMax Forums/Brucey's Modules/FreeImage incbin problem

Armitage 1982(Posted 2008) [#1]
Hi Brucey :)

I would like to load some gif instead of animated tile sheet.
Unfortunately I suspect there is a problem with incbin(ed) image.
"incbin::" stream refuse to work as intended.

Am I Wrong somewhere ?

' TEST 7
'
' Load and display an animated gif using incbin:: - loading all frames into a TImage

SuperStrict


Framework BaH.FreeImage
Import brl.glmax2d
IncBin "anim.gif"

Graphics 800,600,0

' load the animated image
Local image:TImage = LoadAnimFreeImage("incbin::anim.gif")
If Not image Then
	DebugLog("Couldn't load...")
	End
End If

Local count:Int = image.frames.length
Local pos:Int = -1


While Not KeyDown(key_escape)

	pos:+ 1
	
	If pos = count Then
		pos = 0
	End If

	Cls
	
	DrawImage image, 400 - ImageWidth(image)/2, 300 - ImageHeight(image)/2, pos

	Flip
	
Wend
End



Armitage 1982(Posted 2008) [#2]
Hum... I don't know if it's a good idea to use freeimage in my project.
In fact there is strange conflict in larger project with LoadImage() or LoadAnimImage() or LoadAnimFreeImage() that I can't reproduce...
The only reason I see is because I'm using Blide and is custom import framework system cause problem.

The bug came after a special "combination"

LoadAnimFreeImage("x.gif")
LoadImage("y.png")
LoadImage("z.png") <= strange bug : Unhandled Exception:Unhandled Memory Exception Error
(line 59 of "image.bmx") t.seqs=New Int[frames]

sometime the bug is at (line 652 of "stream.bmx") path=path.Replace( "\","/" )

And that's why I really don't understand...

GLMax2DDriver() and Graphic() are set before (since it won't work after)


Brucey(Posted 2008) [#3]
"incbin::" stream refuse to work as intended.

You probably should add this :
Import BRL.RAMStream



Armitage 1982(Posted 2008) [#4]
Sorry but this change nothing :s


Brucey(Posted 2008) [#5]
Ah... my bad. Multipage Bitmap in FreeImage only appears to support loading from files, rather than via Handles for standard images....
FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, ...

Not much I can do about that, unfortunately.


Armitage 1982(Posted 2008) [#6]
Effectively it's quite understanding !
Too bad they add this constance value but that not a big deal ;)
I just have to separate animation on sprite sheet rather than using gif.
Thanks :)