Page 1 of 1

U7 .shp files and bitmaps

Posted: Sat May 18, 2002 2:22 pm
by James
Hi all,

I have a weird problem. I've been working on a tool to convert u7 .shp files to windows .bmp. When I open up the newly generated bitmap file with paint the image is all screwed up, but when I load the same bitmap into a program I wrote it comes out fine (except for images that are screwed up anyways due to offsets being wrong, I believe). Any help would be greatly appreciated. Thanks.

-Beholder

Re: U7 .shp files and bitmaps

Posted: Sat May 18, 2002 2:31 pm
by Dominus
hm, it might be useful to look at the code of Exult as Exult Studio already has the option to export frames from the shp files (frames might even be what makes Paint screw up) as png files.

Or even look at the code of shp2pcx in /tools of the exult code

Re: U7 .shp files and bitmaps

Posted: Sat May 18, 2002 3:14 pm
by James
I'll take a looksie, thanks.

-Beholder

Re: U7 .shp files and bitmaps

Posted: Sat May 18, 2002 3:14 pm
by wjp
From what you say it seems as if you're writting invalid bitmaps.

Re: U7 .shp files and bitmaps

Posted: Sat May 18, 2002 3:16 pm
by Nuclear Loser
does the program you wrote show other bitmap files fine??? Also.. try your bitmaps with another viewer as well.

Re: U7 .shp files and bitmaps

Posted: Fri May 24, 2002 9:22 pm
by James
It would seem that I'm writing the bitmaps incorrectly. I don't understand what's wrong with it though. It's just the image buffer I think, because all of the header fields and the palette seem fine.

I calloc() the appropriate size of memory and double check to make sure it's right and then just set all of the bytes to 255. After writing it to file it still comes out weird. Can I post the parts of the code that seem to be the trouble? (it's not very big)

Re: U7 .shp files and bitmaps

Posted: Sun May 26, 2002 2:03 am
by Kristoph
Go read the bitmap specification. That format is evil, I know about it myself :)

The biggest problem I got is that all lines must be have a length multiple of 4 bytes. So add padding at the end of your lines.

Re: U7 .shp files and bitmaps

Posted: Sun May 26, 2002 10:19 am
by James
Wow, it is evil...That was it the whole time. Thanks!!!!! =)

(Beholder invented a few new swearing combos because of this)

-Beholder