HOME - - - - - Lazarus Tutorials TOC - - - - - - Other material for programmers
StumbleUpon.ComRecommend to StumbleUpon

Using XOR in graphics programming

A clever wheeze!

file: lt4Ne-XorDemo.htm)

This isn't like most of my other pages... and is unlike the pages that say that!

While there's little explanation here about the code this page makes available to you, there is a lot of "tutorial" stuff to be gleaned from the free, downloadable sourcecode demonstrating the use of XOR in graphics programming.


In a nutshell, using XOR makes it really simple to make things appear and disappear on the screen. This can be used, say, to make it look like a ball is moving across the screen... homage to Pong, please!...

You draw the ball at, say, the left hand edge. Let that stay there a moment. Then "undraw" it, and (very quickly) re-draw it, but just a bit to the right of where it was before. Keep this up, and people will "see" a ball moving across the screen.

There's an .exe in the .zip which is merely what the sourcecode there produces. But you can run it to see what the sourcecode does. (By the way, it will run directly from the merely viewed .zip, but it will moan when you quit, because it is trying to write to an .ini file. No harm done, but (of course) what would have gone into the .ini file (primarily your wishes regarding the size and position of the window) is lost.

The application gives you a chance to see XOR in action, and to look at the code achieving the effects you see.

What are you waiting for? Go download it; have fun!

(The program also uses some other neat tricks unrelated to the XOR tool. Not how it manages to create a "trail" of squares appearing and disappearing. (Buttons "Button6-fast" and "Button6-slow".)

   Search this site or the web        powered by FreeFind
  Site search Web search
Site Map    What's New    Search   BEWARE: There is stuff at my other two sites that the search above won't reveal. Go to either site (see links below) and use that site's FreeFind search button.

BEWARE: The search above only visits a selection of my stuff. Go to either of my other sites (see links below) and use that site's FreeFind search button, if you haven't found something you "know is there".

In addition to the tutorials for which this page serves as Table of Contents, I have other sites with material you might find useful.....

My other sites....
Sheepdog Software homepage.
My Arunet homepage.

... and some links to specific pages within them you might want....
You can't "play" all day... learn to use the Libre Office/ Open Office database. Free. Multi-platform.
The Arduino- LOTS of fun, for not much money. And beginner (intelligent beginner) friendly. And good pursuit for kids. Combine programming and electronics!
Designing printed circuit boards the KiCad way. Free. Multi-platform. Long established. PCB-fab houses take native KiCad files.
And lastly... Making maps... how we did it before GPS Indulge me? This discusses a worthwhile, fun (if presented intelligently) activity for kids, which can be undertaken on many levels... a simple 20 minutes, or weeks of engaging activity. (Also known to divert susceptible adults.)

Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, please at least help me with Facebook links, etc (buttons at top of page). If you run an MS-DOS or Windows PC, please visit my freeware and shareware page, try something? Links on your page to this page would also be appreciated, of course!
Click here to visit editor's freeware, shareware page.

   Here is the way to contact the author of these Lazarus/Delphi tutorials, Tom Boyd.

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. (Mostly passes. A few problems caused by Google+ code.)

If this page causes a script to run, why? Because of things like Google panels, and the code for the search button. Why do I mention scripts? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....