Screen('DrawTexture', windowPointer, texturePointer [,sourceRect] [,destinationRect] [,rotationAngle] [, filterMode] [, globalAlpha] [, modulateColor] [, textureShader] [, specialFlags] [, auxParameters]);
Usage:
Draw the texture specified via 'texturePointer' into the target window specified via 'windowPointer'.
'sourceRect': specifies a rectangular subpart of the texture to be drawn (Defaults to full texture).
'destinationRect': defines the rectangular subpart of the window where the texture should be drawn. This defaultsto centered on the screen.
'rotationAngle': Specifies a rotation angle in degree for rotated drawing of the texture (Defaults to 0 deg. = upright).
Screen('DrawDots', windowPtr, xy [,size] [,color] [,center] [,dot_type][, lenient]);
Usage:
Quickly draw an array of dots. "xy" is a two-row vector containing the x and y coordinates of the dot centers, relative to "center" (default center is [0 0]).
"size": is the diameter of each dot in pixels (default is 1). Instead of a common size for all dots you can also provide a vector which defines a different dot size for each dot. Different graphics cards do have different limits on the maximum size of dots, 10 or 63 are typical limits.
"color": is the the clut index (scalar or [r g b a] vector) that you want to poke into each dot pixel (default is black). Instead of a single "color" you can also provide a 3 or 4 row vector,which specifies an individual RGB or RGBA color for each corresponding point.
"dot_type": is a flag that determines what type of dot is drawn: 0 (default) and 4 draw square dots
一个实例:
screens=Screen('Screens');
screenNumber=max(screens);
[w, Screenrect] = Screen('OpenWindow', screenNumber, 128, [0 0 800 600]);
Screen(w,'BlendFunction',GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
load dotinfo;
png = imread('max.png');
pngtext = Screen('MakeTexture', w, png);
Screen('DrawTexture', w, pngtext, [], CenterRectOnPoint([0 0 ISA(dn) ISA(dn)],Screenrect(3)/2+squeeze(xys{dn}(:,i,1)),Screenrect(4)/2+squeeze(xys{dn}(:,i,2))));
Screen('Flip', w);
imageArray=Screen('GetImage', w, CenterRect([0 0 224 224],Screenrect));
imwrite(imageArray,sprintf('stims/img_%02d_%03d.png',dot_number,i));