In the days before graphics cards with in built logical screens and API’s to manipulate them, computer’s generally implemented their screens in computer memory, which you could directly write to. It was all a lot more simpler, but lacked even the most basic functions.
A common issue would be, particularly with displays which were black and white, would be once the item was displayed, it would be mixed up with the background, often so much so, it would be impossible to see.
Above is our little spaceship, it’s easy to make out when it’s against a blank white background, but the second it enters into anything behind it.
You can see, the spaceship begins to mix in with the mess of the background and become impossible to see.
Of course, you could keep a big white square behind the spaceship, but that would then make the background vanish and not look particularly great.
Along with the little spaceship, we create a mask graphic which denotes which bits around the spaceship we’d like to be transparent (so the background shows), and which bits we’d like only the spaceship to be visible on.
This overlay doesn’t get printed, but we use basic logic to decide what should show and what shouldn’t show.
The masking rules above show, that a 0 in Mask means the background gets through (ie, nothing is rendered to the screen, it’s left as it is). The 1 in mask ensures the screen only shows the space ship, and removes the background.
Because the mask is just a little larger than the spaceship, this has the effect of clearing a bubble around the spaceship, making it easier to view.
So now you can see the spaceship flying through the darkened background, without the corruption that occurs when you don’t use a mask based solution.
Of course, graphics cards and API’s today can do all these lovely tricks at the hardware level, but it’s sometimes nice to remind ourselves what’s going on behind the scenes.