The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

StampTV: Fun with overlay

Contributed by: Ben Allen
This tip is valid for: Both BeOS and Haiku

If you are the lucky owner of a graphics card with overlay support in BeOS, then this discovery made by Ben Allen will be of interest and possibly useful application when used in conjunction with StampTV and a video capture card.

While StampTV is on screen, press the Print Screen key to take a screen shot. Hide (minimize) StampTV and open your Home folder to look for the image just saved. Open the screenshot in ShowImage and you’ll notice that the StampTV window in the still image is still being updated by the StampTV app.

Now that you have an image with a “live update”, you can do several things with it. My personal favorite is giving one workspace the screenshot as a background. As long as StampTV remains opened and minimized (you can do this at startup with the ‘hey’ utility) you have TV straight on your desktop. You can also cut a rectangular region out of the image of the TV window as if you were cropping the image and save that image as a new .PNG file. This image will display a smaller region of the TV screen and can be moved around at will to display different parts of the TV screen. There are probably tons of other things you can do with this phenomenon, have fun!

Editor’s note:

This strange effect is caused by the overlay mechanism on the graphics card, as opposed to fancy replicant support, so while you won’t be able to treat the image as if it were a video file, there are still some interesting and useful effects which can be achieved.

Overlay is a technique used by some graphics cards to improve video performance, and in this case works using the Chroma Keying method. Simply put, StampTV paints the main window with a “magic colour”, and then tells the video capture card to write the video into the StampTV window location directly, bypassing the CPU.

While this makes for extremely fast graphics, since it bypasses the slow CPU, the TV tuner would overwrite any windows, menus or dialog boxes on the screen where the TV image is showing.

To combat this problem, chroma keying is used. The TV image will be written directly to the graphics card as before, with the exception that it will only be displayed in areas which are the “magic colour”. Overlapping dialog boxes and windows will not be covered-up by the TV image, since they do not consist of the magic colour. This effect is very similar to the “blue screen” chroma keying used on TV weather reports, where the desired image is only displayed in place of a “key colour”.

As you can probably imagine, there are quite a few interesting effects you can get by intentionally using the magic colour. It appears that StampTV continues to update the video card even when the window is hidden. Since the magic colour normally does not occur in the BeOS GUI, there is no immediate visible evidence. While this might be perceived as a bug, it is rather fortunate since it enables the creation of several interesting effects.

By setting the desktop background colour to the value of the magic colour, the desktop background will continue to display a TV image, replicant-style, even when StampTV is hidden. Finding the exact value of the magic colour is a more difficult process than it sounds, since different applications report different values — especially in 16 bit colour or lower.

A possible work-around is to use an image file containing the colour — the ArtPaint colour-picker can be used to extract the magic colour from a screenshot of StampTV. By creating an image file with the magic colour, StampTV will update the areas of magic colour in its old window location, prior to hiding. Zooming StampTV to fill the screen and hiding it will let you create a “video wallpaper”.

Ben Allen suggests another useful application for this effect. It might be possible to “clip” the stock/sports ticker off the news channel and display it on the desktop, or indeed any other part of a video feed — even the TV output from another PC.

Without a specialized application, this requires some work, but it should be possible to do. Locate StampTV so that the area you are interested in falls on the area of the desktop you want it. Take a screenshot of the desktop, and crop the appropriate area of the TV image out of the screenshot (this requires some guesswork, since you won’t be able to see the image — just the magic colour). Hide StampTV, and set this image as wallpaper. Use “manual placement”, and move it around the desktop until it is in the right location — at this point, it should be displaying the video feed live. Careful manual positioning may be required to get it to line up perfectly — moving StampTV and re-hiding it might be easier for fine positioning.

– Cyan Helkaraxe (tip server editor)

Posted in Applications

(comments are closed).