The T-Lock System


Sending a code to the video memory

The Bits++ has been designed such that if its video memory is sent a particular combination of 24 bytes it knows that the next few hundred bytes should not be interpretted as pixel colours but should be used to set the values in the CLUT. These 24 bytes are called the T-Lock code. This code and the palette that follows it are not displayed on the screen.

In this way you can change the CLUT using the same commands that you would use to display a line of pixels. For example, you could change the CLUT using the Screen('DrawTexture'...) command provided by the Psychtoolbox. This is how the CLUT is usually changed in the demos provided by CRS for the Bits++. But you could also use any other method which draws on the Bits++ video memory.

Using a bitmap file with a T-Lock code in it

You could create a .bmp file containing the T-Lock code and a palette, open that .bmp file in any graphics application, like Photoshop or Paint, and drag that application's window onto the secondary monitor - the one connected to the computer via the Bits++. As soon as the .bmp is on the secondary screen the Bits++ will see the T-Lock code and the screen will change colour. In fact this is a quick and easy way to confirm that the T-Lock system is working.

T-Lock and PaletteIf you have a Bits++ connected to the computer on which you are reading this article, you could try this right now. Just drag this window onto your secondary screen. As soon as the image shown above appears on the secondary screen it should turn "red-scale" because the image contains a T-Lock code followed by 256 RGB values in which the reds are linearly increasing and the greens and blues are all zero.

Note:
If you look very carefully (perhaps through a microscope!) you might notice that the "red-scale" T-Lock image provided here actually consists of two indentical lines, one of which is shifted one pixel sideways with respect to the other. This is because the T-Lock system requires that the code is aligned on an evenly numbered pixel. Designing the bitmap in this way ensures that one of the two lines triggers the CLUT change wherever it is positioned on the screen.

How the Demos Use the T-Lock System


The demos that you can download from the CRS website contain four folders. There is one folder for each of the three modes in which the Bits++ can be used (Mode names: Bits++, Colour++ and Mono++) and there is another folder called 'common'. This is for MatLab scripts and any other files that are generally useful. It contains two MatLab scripts that are used extensively by the demos for changing the CLUT using T-Lock:

Valid XHTML :: Valid CSS: :: Powered by WikkaWiki