I don't need to save the result. My goal is to show some color graphics on top of a still background which comes from a video stream.
Imagine the inside working of a slot machine. At first, you see a still image of the three wheels, let's say an orange, a lemon and an apple.
When a player puts in a coin and gives the start signal, you see a live motion picture of the spinning wheels. After a random delay of few seconds, the movie freezes and shows a still image of two lemons and one apple. Please note that I'm NOT describing my real application. This is just an example. When the movie freezes, I have to superimpose some simple animated graphics on top of the wheels. For example, I could faint the apple from glow red to dark green, or squeeze the lemon. In case of a triple match (jackpot), I could turn the three apples to one big apple pie with a flashing 100 or 134 or 2612 or whatever else is the running score. I'm tempted to simply "hardwire" as still image each and every possible score, but I feel more viable to take a snapshot of ten single digits from 0 to 9, then arrange them in real time on top of a still background.
If possible, I would like to code one single executable which manages to read from some regular files, and painlessly write in real time to some virtual resource which represents the visible surface of the screen.