×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# QBasic FAQ

## Graphical Techniques in QB

 The fastest way to save a graphic screen to disk using Qbasic by Alt255 faq314-136 Posted: 13 Jul 00 By popular demand, here is your BSAVE and BLOAD programming example.'Set the graphics mode...SCREEN 8 '640 x 200 Resolution'Set up an array large enough to store the contents of the screenREDIM GraphBlock(1 TO 31266)'You determine the required size of the graphics array with:'Bytes = 4 + INT(((X2-X1+1)*(Bits/pixel/plane)+7)/8)*planes*((Y2-Y1)+1)'In SCREEN 8 that would be 62532 bytes for an array size of 31266.'Draw a graphic....X = 150: Y = 2DO    CIRCLE (X, Y), Y / 4, (Y / 16) + 1    CIRCLE (X - Y, Y), Y / 4, (Y / 16) + 1    CIRCLE (X + Y, Y), Y / 4, (Y / 16) + 1    IF Y > 200 THEN EXIT DO    X = X + LOG(X * Y) / Y    Y = Y + LOG(Y) / 10LOOP'Place the contents of the screen in the array...GET (0, 0)-(639, 199), GraphBlock'Set the memory segment to first element of the arrayDEF SEG = VARSEG(GraphBlock(1))BSAVE "Screen.Img", VARPTR(GraphBlock(1)), 62532 'save it to a fileDEF SEG 'Reset the default memory segment to the Qbasic areaCLS 'To show that this actually works, clear the screen...'and erase the array.ERASE GraphBlockPRINT "Press a key to load screen..."DO WHILE INKEY\$ = ""LOOPREDIM GraphBlock(1 TO 31266)DEF SEG = VARSEG(GraphBlock(1))BLOAD "Screen.Img", VARPTR(GraphBlock(1))DEF SEGPUT (0, 0), GraphBlock, PSETThe graphic has returned to the screen. A lot quicker the second time, eh? Back to QBasic FAQ Index Back to QBasic Forum

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!