Re: Qbasic graphics.

 BBS: Inland Empire Archive
Date: 03-05-92 (11:56)             Number: 178
From: LAWRENCE MCALPIN             Refer#: NONE
  To: KAMEL DIDAN                   Recvd: NO  
Subj: Re: Qbasic graphics.           Conf: (11) Modula-2

In my MEGASprite! package I include some information on ways to use those sprites in animation. I'll try to explain them to you so you can do that to with whatever you use. Basically, I define a sprite is a block-graphics area, and you can 'GET' a sprite with the graphics GET command in QBasic or QuickBASIC. Once you have this sprite, there are two techniques I commonly use: 1) PUT the sprite wherever you want with the XOR parameter, then XOR it at the same location to erase it, restoring the background. Then XOR it again at the new location, and XOR it again when you decide to move it. Etc., etc. It's easy to do, but the problem is you'll get color bleed-through as the background will blend in with the foreground (sprite). 2) Analyze your sprite using POINT for every non-background color (non-zero) PSET a white pixel somewhere else on screen. This should come up with another sprite shaped the same but with white for every colored pixel in your normal sprite. GET both of these sprites. The 'normal' sprite is the one users of your program will see, and the white sprite is a 'matte'. To put the sprite onscreen without overwriting the background but without causing color bleed-through, OR the matte onto the background somewhere. Then AND the 'normal' sprite onto that. To erase the sprite, you will have to have GET (got?) the background area first though, and then just PUT the background at that location, GET the new background you will be overwriting, and do the OR/AND technique again. This is a tad bit slower, uses more memory (as you have to have three sprites in memory for each figure you want to animate), but looks better. I'm sure there are other techniques, but these are the only ones I've basically used. The latter technique I haven't used as often, but it's worked fine in tests I made of EGA sprites I created with my program on various backgrounds. --- * Origin: The_Proving_Grounds,IL USA(309)647-5341 HST V32B (1:232/26)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET