TGA files - upside down?!

BlitzMax Forums/BlitzMax Programming/TGA files - upside down?!

iprice(Posted 2008) [#1]
I've recently implemented .TGA loading into an app I'm making and got some odd results.

I loaded in 3 .TGA files; when displayed two of them appeared upside down, but the other was fine.

All 3 were perfectly valid and correctly orientated in other apps that can view .TGA.

Is there a problem with the TGA Loader module?

I know .TGA isn't that popular, but it's something I want to keep in in my app. I've got a flip h/v option anyway, so it doesn't really matter, but I've found no mention of this elsewhere. Is this a bug?


ImaginaryHuman(Posted 2008) [#2]
I know sometimes there is some vertical flipping of pixmaps going on behind the scenes, possibly if the pixmap has to be resized or its format changed?


fredborg(Posted 2008) [#3]
You can try patching BRL.TGALoader with this:
		'
		' Flip Horizontal
		If (hdr.attbits & $10) = False
			pixmap = XFlipPixmap(pixmap)
		EndIf
		'
		' Flip Vertical
		If (hdr.attbits & $20) 
			pixmap = YFlipPixmap(pixmap)
		EndIf
Insert at line 214, just before the return pixmap statement...

It may or may not work :)


iprice(Posted 2008) [#4]
Cheers chaps

I won't need to patch (this time), as I've got flipping in the app anyway, so that the user can modify the background, but it was just something that came up unexpectedly.