IT lexicon › Programming › XOR sprite

XOR sprite

Programming På svenska → Updated: 2026-10-27

An object drawn by XORing it onto the background and erased by drawing it again in the same place.

Since a XOR b XOR b always gives back a, there is no background to save and no mask to store. Draw it, draw it again, and the screen is exactly as it was. For machines short on both memory and cycles it was almost too good to be true.

The catch is that the object never gets its own colours: it becomes an inversion of whatever lies beneath, and where two XOR objects overlap they cancel each other out. So the technique ended up mostly in mouse pointers, text cursors and rubber-band selection boxes, where being visible against both light and dark backgrounds is a feature. Cadtrak's 1980 patent on the XOR cursor collected licence fees from much of the industry and became an early cautionary tale in the software patent debate.

← Back to the lexicon