/usr/share/psychtoolbox-3/PsychHardware/BitsPlusToolbox/BitsPlusClut2Texture.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | function texturePtr = BitsPlusClut2Texture(windowPtr, clut)
% texturePtr = BitsPlusClut2Texture(windowPtr, clut)
%
% Generates a PsychToolbox texture containing the CLUT + magic code
% required to set the clut in Bits++ mode.
%
% 'clut' should be a 256x3 matrix consisting of values in the range
% specified by Screen('ColorRange'), which is by default [0, 255].
if nargin ~= 2
error('Usage: texturePtr = BitsPlusClut2Texture(windowPtr, clut)');
end
% Convert the clut into the current color range.
colorRange = Screen('ColorRange', windowPtr);
clut = clut / colorRange .* (2^16 - 1);
% Convert the clut into the special one for Bits++.
newClutRow = BitsPlusEncodeClutRow(clut);
% Generate the texture holding the Bits++ clut.
texturePtr = Screen('MakeTexture', windowPtr, uint8(newClutRow));
|