|
|
| Can you BLOAD (basic graphics format) images in C? |
|
MickyD
Member #2,409
June 2002
|
Is there a way to load BSAVEd images (the basic image format) into a bitmap using allegro? |
|
ReyBrujo
Moderator
January 2001
|
If you have the definition of the format, you should be able to convert that struct into a bitmap. However, load_bitmap by itself cannot do that. You can load anything in almost any language (in all serious language) if you know the format of it. RB -- |
|
Bob
Free Market Evangelist
September 2000
|
The first 7 bytes are junk - they are only useful for the BASIC interpreter. They contain some segment information, etc. All the bytes aferwards are the raw dump of what you saved using BSAVE. -- |
|
Matt Smith
Member #783
November 2000
|
I doubt that there is a palette. QBASIC is older than VGA |
|
Johnny13
Member #805
October 2000
|
Alg3D Praise my Games!!<code>#define SPAMMER (post>=666&&postperday>=6)</code><Mr.spellcaster>What post? <Mr.spellcaster>A useful post by me. |
|
DanTheKat
Member #1,990
March 2002
|
MUAHAHAHAHAHAHAH!!! I CAN'T BELIEVE YOU THINK YOU CAN USE THE BLOAD FORMAT IN C/ALLEGRO!
--- |
|
Gabhonga
Member #1,247
February 2001
|
afaik there's no way to know the proper width/heigth of a bsave'd file. byte 6&7 of the header (raw data starts at byte 8) only indicate the total size of data, the programmer has to make sure of proper width by himself! for(int h=0;h<BSAVED_H;h++) { for(int w=0;w<BSAVED_W;w++) { putpixel(bitmap,w,h,bsaved[(h*BSAVED_W)+w+8]); } }
should do the trick then. katman: you can read any type of file from c...whatever silly format it is. -------------------------------------------------------- |
|
MickyD
Member #2,409
June 2002
|
I'll try it. Anyways someone asked if people still make games in QB. yep, here is one I have been working on for a long time. It is way better than you would expect (it being coded in QB and all). http://typosoft.qbasicnews.com/pedxing.put |
|
lillo
Member #303
April 2000
|
Heh, time to show my QB backgrounds Ga Bhonga, that's not completely true... it depends from what source you bsaved your image. def seg=&ha000 bsave "image.bsv", 0, 64000
IIRC that'll save 64000 bytes from address 0xA000:0 (mode 13h framebuffer address in real mode), that's an entire 320x200x8 screen. So no size info is saved, as there's no way to guess it from QB. byte desc 0 Identification byte. Must be 0xFD 1-2 Source segment from where the data was saved 3-4 Source offset 5-6 Length of saved data in bytes 7-... the actual data So if the bsaved data was saved from a GET buffer, you'll also have: 7-8 Width of image / 8 9-10 Height of the image 11-... Image data
Hope it helps coding your own C loading routines -- |
|
Gabhonga
Member #1,247
February 2001
|
aah, didn't remember GET and PUT at all...::) -------------------------------------------------------- |
|
MickyD
Member #2,409
June 2002
|
How do you use fread to read a whole file and store every byte from that file into an array? Here is what I have so far... I'm working with a 100x100 sprite bsaved with QB. int w, h, BH, BW; This puts garbled pixels on the screen, but they are the right colors! |
|
DanTheKat
Member #1,990
March 2002
|
I had trouble with fread, and the other file stuff, and I still do, heh.
--- |
|
Johnny13
Member #805
October 2000
|
Quote: def seg=&ha000 it sucks! ah my eyes! Alg3D Praise my Games!!<code>#define SPAMMER (post>=666&&postperday>=6)</code><Mr.spellcaster>What post? <Mr.spellcaster>A useful post by me. |
|
spellcaster
Member #1,493
September 2001
|
Quote: it sucks! ah my eyes! Oh yeah, let's start one of these discussions But that info is kinda cool. It would allow us to write an importer / exporter for QB. There're some nice tools written in QB (mainly RPG related), and allowing to import / export data in that format might be very helpful (if you're doing a sprite editor for example). It would allow you to adopt the complete QB userbase, which is still rather larger. It would also give some of the QB guys a nicer start in C coding (and maybe even enough motivation to switch). To be honest, I never thought the BLOAD/ BSAVE format was specified... or has somebody reverse engineered it? -- |
|
lillo
Member #303
April 2000
|
Here's an (untested) little function that should work like the other Allegro load_* image loading functions; if it finds additional data appended to the file it'll store it as palette data into the palette parameter, otherwise palette will remain unchanged.
-- |
|
Mandrake Root Produc
Member #300
April 2000
|
heh, cool |
|
MickyD
Member #2,409
June 2002
|
DUDE! that worked! Thank you sooo much. |
|
David Grace
Member #42
April 2000
|
Wow. BLOADed graphics. That was my first brush with file-based sprites, too. I even figured out a way to make a (partially) clipping PUT drawing routine. It only worked vertically...if the sprite was clipped horizontally it'd do strange things. I didn't know enough about how EGA video RAM was structured to make it more intelligent than that. (in 4 4-bit planes, like the old VGA modes, in case you wonder. I haven't seen that in ages. I've even still got a few of my old GWBASIC games around... _______________________________ |
|
|