BSAVE and BLOAD

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Pete
Site Admin
Posts: 887
Joined: Sun Dec 07, 2003 9:10 pm
Location: Candor, NY
Contact:

BSAVE and BLOAD

Post by Pete »

Have at it, guys! (I'm too busy...)
Do you know how i can BSAVE and BLOAD .JPEG and .GIF files??
I want to import filkes into my program from another file in the foler where the program is.
Also, if i wanted to draw a bvright yellow circle, which is on a red background (the yellow circle is filled in yellow) on screen 13? I tried doing graphics with the DATA command, but they never showed up on the screen even though i madew an image of a cat's head (A white cat).
Thanks,
Benjamin
bjp20003000 *AT* yahoo.ca
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

You cant BSAVE/BLOAD JPEG or GIF files. End of story.

Roughly, iirc:

Code: Select all

screen 13
paint (0,0), 4
circle (160,100), 20, 14
paint (160,100), 14, 14
DATA statements do not draw anything, you need to make a routine to actually draw stuff.
I have left this dump.
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

Z!re wrote:You cant BSAVE/BLOAD JPEG or GIF files. End of story.

Roughly, iirc:

Code: Select all

screen 13
paint (0,0), 4
circle (160,100), 20, 14
paint (160,100), 14, 14
DATA statements do not draw anything, you need to make a routine to actually draw stuff.
BSAVE/BLOAD: Cannot be done, just like Z!re said.
CIRCLE: Yes, DATA statements do not draw. Try this.

Code: Select all

FOR y = 1 to MaxY
   FOR x = 1 to MaxX
      read Col: PSET(x, y), Col
   NEXT x
NEXT y
If you don't understand that, please say so.

IMPORTING: I am not sure what you mean. If you mean importing subs, then you need to compile it into a library, but that is a more advanced topic. Check the tutorial section.

If you mean linking to another file, just use the CHAIN statement. Check QBs inline help.

If you mean using varibles in a different file, then put the varibles in a file (such as this one)

Code: Select all

Ilikeeggs = 1
StopTheCommyNaziHippies$ = "By saying the cheese stands alone."
Just put it in a file and put this at the beginning of your program.

Code: Select all

'INCLUDE:'yourfilenamegoeshere.bas'
Image
User avatar
matt2jones
Veteran
Posts: 80
Joined: Sat Feb 19, 2005 8:29 am
Location: elsewhere
Contact:

Post by matt2jones »

you could use mspaint to save them as .bmp files and use freebasic to bsave/bload them however.

Or you could find a gif loader (there are loads at Qbasic.com) and bsave the screen, for futuring bloading.

ditto with the jpeg pics....

Or you could save the jpegs as .bmp and use a bmp loader (I've only found one jpeg loader before)...

You can't do it in one step, but it can be easily done with a little go-between program.

matt
Do not mistake Apathy for feeling Content.

http://www.disjointed.cjb.net - Short Storys
http://matt2jones.deviantart.com - Random Art
http://www.freewebs.com/matt2jones - WebComic
Antoni
Veteran
Posts: 132
Joined: Wed Jun 15, 2005 3:01 pm
Contact:

Post by Antoni »

Forget about loading JPEG in QB, I once did a loader, it added 30K to the compiled program. JPEG is off limits for everyday use in QB.
You can find several good gif loaders around.
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

antoni: he means to load it once and then convert it into a BSAVE file.

eg (psuedo code)

Code: Select all

LoadJPEG("myfile.jpeg")
get (0, 0)-(10, 10), hi
bsave hi
And then use the bsave file...

i really need to fix this shift key.
Image
Post Reply