/usr/share/psychtoolbox-3/PsychAlphaBlending/AlphaTimes.m is in psychtoolbox-3-common 3.0.14.20170103+git6-g605ff5c.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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | function matProduct=AlphaTimes(mat, alpha)
% matProduct=AlphaTimes(mat1, alpha)
%
% Calculate the product of an image matrix and alpha as would Screen Alpha
% blending: Pointwise multiply and round. Argument 'alpha' may
% be either a scaler or the alpha plane. If an alpha plane, it must have
% the same x y dimensions of argument 'mat'.
%
% see also: AlphaSum, PsychAlphaBlending
% HISTORY
%
% mm/dd/yy
%
% 2/11/05 awi wrote it.
alphaDims=size(alpha);
matDims=size(mat);
alphaFraction= alpha/255;
%multiply, expanding alpha to the dimenstionality of mat for pointwise
%multiplication
if length(alphaDims) == 2
if alphaDims(1) * alphaDims(2)==1
matProduct=mat * alphaFraction;
else
expandedAlphaPlane=repmat(alphaFraction,[1,1,matDims(3)]);
matProduct=mat .* expandedAlphaPlane;
end
elseif length(alphaDims) == 3
matProduct=mat .* alphaFraction;
end
%matProduct=round(matProduct);
% alphaDims=size(alpha);
% matDims=size(mat);
%
% %multiply, expanding alpha to the dimenstionality of mat for pointwise
% %multiplication
% if length(alphaDims) == 2
% if alphaDims(1) * alphaDims(2)==1
% matProduct=mat * alpha;
% else
% expandedAlphaPlane=repmat(alpha,[1,1,matDims(3)]);
% matProduct=mat .* expandedAlphaPlane;
% end
% elseif length(alphaDims) == 3
% matProduct=mat .* alpha;
% end
%
% %matProduct=round(matProduct);
% matProduct=bitshift(matProduct,-8);
|