Page 1 of 1

BSAVE and BLOAD

Posted: Mon Oct 24, 2005 10:42 am
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

Posted: Mon Oct 24, 2005 11:33 am
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.

Posted: Mon Oct 24, 2005 2:44 pm
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'

Posted: Tue Oct 25, 2005 4:03 am
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

Posted: Tue Oct 25, 2005 2:02 pm
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.

Posted: Tue Oct 25, 2005 2:44 pm
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.