sca;
close all;
clear;
PsychDefaultSetup(2);
screens = Screen('Screens');
screenNumber = max(screens);
white = WhiteIndex(screenNumber);
black = BlackIndex(screenNumber);
grey = white / 2;
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, grey);
[screenXpixels, screenYpixels] = Screen('WindowSize', window);
ifi = Screen('GetFlipInterval', window);
[xCenter, yCenter] = RectCenter(windowRect);
Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
theImageLocation = [PsychtoolboxRoot 'PsychDemos' filesep...
'AlphaImageDemo' filesep 'konijntjes1024x768.jpg'];
theImage = imread(theImageLocation);
[s1, s2, s3] = size(theImage);
presSecs = 2;
waitframes = round(presSecs / ifi);
imageTexture = Screen('MakeTexture', window, theImage);
vbl = Screen('Flip', window);
Screen('DrawTexture', window, imageTexture, [], [], 0);
vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
Screen('FillRect', window, [0 1 0]);
vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
Screen('DrawTexture', window, imageTexture, [], [], 180);
vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
WaitSecs(presSecs);
sca;