|
Bitmap loses data when transferred into Allegro datafile? |
XcronZ3X
Member #8,222
January 2007
|
Hello. I was having some problems with a game I was making after I tried to implement Allegro datafiles instead of separate files for all the sprites and sounds. I then made a test program to test and see if everything was being transferred fine. The bitmaps with one single frame/sprite were transferred fine and retained all data. However, I have two bitmaps that have several frames of a tank in them and it seems that when they are transferred into the datafile, it just becomes all black and that is what is copied to the datafile. Can anybody help me? |
Steve Terry
Member #1,989
March 2002
|
I'm assuming those bitmaps were gifs and the datafile utility doesn't support gifs natively, though it will still import them as binary data. ___________________________________ |
XcronZ3X
Member #8,222
January 2007
|
Actually, the bitmaps were really BMP files...that's why almost all of them worked. Allegro datafiles support the BMP filetype. But for some reason the two tank BMPs that have several frames right next to each other turned into just a black strip when transferred into the datafile. It's very strange. All the other bitmaps work, but these two don't... I can also import them into the datafile through binary data? Maybe I should try that...to see if the tank bitmaps will retain the data..if that's an alternative method. |
Matthew Dalrymple
Member #7,922
October 2006
|
I probably can't help you, but to those who are very familiar with your topic... you might want to supply them with some source and the images. But that is just a suggestion. =-----===-----===-----= |
Steve Terry
Member #1,989
March 2002
|
What is the bit depth of the tank images? ___________________________________ |
XcronZ3X
Member #8,222
January 2007
|
Good idea, I had actually not thought of that. I think this will be very helpful for any willing to help me out. Ok..so! Anything like explode.bmp (attached), where there is but a single frame of the object, is transferred fine and by using my test program..I can retrieve and save the exact same thing from the data file. Now, for something like tank1.bmp (attached), with multiple frames and such, it turns into tank1saved.bmp (attached) after I run my test program. This is the code that I basically use for the test program: allegro_init(); Oh, and the color depth of the tanks and all the sprites/images that I use is 16-bit. Dunno..just a default thing I guess...I'm only learning with a book so..heh.. |
LennyLen
Member #5,313
December 2004
|
Can you also attach the smallest .dat file that the problem occurs with? edit: I Just noticed that tank1.bmp is a 8bit image, but you have no palette information. The rest of the images you supplied are 24bit.
|
XcronZ3X
Member #8,222
January 2007
|
Mmmmmmmm...8-bit....wonder when I did that.. Ahh..the datafile...ok I've attached the only one I use..with compression, it's small enough. Well if the others are 24-bit and they are transferred fine...then I...meh...I dunno..maybe the 8-bit just doesn't work with my 16-bit setting...probably should do a conversion to 8-bit at the beginning of the test program or something.....hmmmm... |
LennyLen
Member #5,313
December 2004
|
Quote: Ahh..the datafile...ok I've attached the only one I use..with compression, it's small enough. No, you haven't. But just try converting the 8bit images to 24bit (or even better 16bit, since it's the depth you set the screen to). That should fix the problem. edit: hey, you cheated.
|
XcronZ3X
Member #8,222
January 2007
|
Sheesh..well, I'm not too sure how I can change the depth of those bitmaps.. you cheat more than I do =P, my computer takes 5 mins to load each of these pages.. |
LennyLen
Member #5,313
December 2004
|
Well, if you're using windows, just load the 8bit images into Paint and save them as 24bit bitmaps. edit: I'm not sure how you managed to do what you did, but I saved your 8bit image to my machine and made a new .dat file with the grabber. I then used the grabber to convert the image to 16bit, and it works fine. I've attached the .dat file with the single bitmap.
|
gnolam
Member #2,030
March 2002
|
Quote: set_color_conversion(16); Err... that's not how you do things. -- |
XcronZ3X
Member #8,222
January 2007
|
actually that call to the conversion was pointless...after trying a lot of different things, I thought I might throw that in..but it didn't change anything..=/ |
Evert
Member #794
November 2000
|
Quote: actually that call to the conversion was pointless... No, it's wrong. Check the manual entry for set_color_conversion(). |
LennyLen
Member #5,313
December 2004
|
Here's a link even:
|
|