Crossplatform bmp and png

BlitzMax Forums/BlitzMax Programming/Crossplatform bmp and png

KamaShin(Posted 2005) [#1]
I wouldn' t ask this question otherwise but I ve encountered a problem that makes me think this could be the case:
I bet you guys kalready know about the bigendian/littelendian thing when reading stream on MAc/PC
I was wondering if there couldn't be a pbm like this one for pictures too... I thought not until I experienced the following:
a png save on my Mac, perfectly working in my BlitzMax game on Mac, gives a Null object when loading it on PC with the exact same code... Then I open the png with paint, resave it, re-run my BlitzMax game and the png is correctly loaded... could it be that this endian problem affects also pictures format??


Oddball(Posted 2005) [#2]
You can convert the streams by using the [a http://www.blitzwiki.org/index.php/Category:Endian_Streams]EndianStream functions[/a], and the compiler directives. Here's more info. Also PixmapFormat and ConvertPixmap might be of some use.


FlameDuck(Posted 2005) [#3]
In the case of PNG, all data is big endian IIRC. Since BlitzMAX uses the same libpng on Mac and PC, I'd say the problem is with whatever application you're using on the Mac failing to save the PNG image properly.


Who was John Galt?(Posted 2005) [#4]
My game uses all the same graphics across Mac and PC - png stands for portable network graphics and should work on PC and Mac with no changes. I've no idea why you're experiencing a problem. My stuff was all originally created on PC - see if those paint created pngs will now load on your Mac.


KamaShin(Posted 2005) [#5]
hmm two possibilities then:
1) when you create the graphics on PC there's no compatibility issue across Mac/PC... but when creating the png on the Mac (or is it an issue with GraphicConverter?) it's just the pc that has some pbm...

2) I once got the same problem trying a pc project a friend send me for testing on mac and graphics were loaded but displayed really strangely... re-saving the files didn't change much however re-compiling the modules did...

the only thing that doesn't match with the second solution is the fact that for the case I was talking about in my first post, opening the pngs and bmps with paint and hitting save in the file menu solved the graphics problem... but then maybe recompiling the modules would have ALSO solved the pbm...
hmmm the best thing I could do is recompile those modules to have something quite optimised for the pc processor however I don t seem to have installed the ming thing correctly (or whatever it s name is)...


Hotcakes(Posted 2005) [#6]
MinGW (Minimalist Gnu for Windows)

I'm with Ducky, I'd blame GraphicConverter in this case. It is a bit strange that it would work on Mac at all though - the image loader modules are supposed to be using exactly the same code on both platforms. More or less. Actually scrub that. Just the more one. <ramble>

Anyway, looking in the png module there's no compiler directive stuff in there so it's truly strange indeed. Whatever GraphicConverter is saving out is not being treated the same on both platforms despite the codebase being supposedly exactly the same - the only thing I can think of is either the Mac or PC version is still using BMax v1.09??? Failing that, there's got to be a compiler bug somewhere.