MATLAB Programming/Psychtoolbox/Screen Commands/SetClutQ

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Usage:

err=Screen(windowPtr,'SetClut',clut,[startEntry],[bits])

Set the DirectDraw palette for the screen.

The palette is set immediately, without waiting for the vertical blanking.

The clut argument is a MATLAB matrix with 3 columns. The number of entries written is the number of rows in clut. Each RGB entry in the hardware CLUT is loaded with a row of clut. Each clut value should be in the range 0 to 255 for an 8-bit CLUT. Argument startEntry is optional and determines which CLUT entry to load first (entries are numbered from 0 up), to load just a subset of the CLUT's entries. We suggest that startEntry always be zero or greater.

The bits argument specifies how many bits you want to write to the CLUT. Typically it will be 8, which is the default value. If you set it to some other value, the range of allowable entries scales accordingly. Thus if you use a 9-bit CLUT, then each entry should be between 0 and 511, etc.