/usr/share/psychtoolbox-3/PsychDemos/ArcDemo.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 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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | function ArcDemo
% ArcDemo
%
% Demonstration of the function Screen('FillArc',...) on OSX
%
% Date of creation: 12/02/05
% Author: Kerstin Preuschoff, Caltech
%
% Previous versions:
%
% History:
% Small changes to make it OSX-ish by Mario Kleiner
%
% Presentation Sequence:
% - the demo basically draws a pie chart (circle with 3 differently
% colored arcs
% - the circle is then partially covered by another arc
%
% Make sure we run on OpenGL Psychtoolbox
AssertOpenGL;
try
fprintf('ArcDemoOSX - Donated by Kerstin Preuschoff\n');
fprintf('First image will show drawing of filled arcs (Pie-Chart style) - Press a key to continue.\n');
fprintf('Second image will show drawing of arc outline with fixed 1 pixel size - Press a key to continue.\n');
fprintf('Third image will show drawing of arc with outline of 5 pixels thickness - Press a key to end demo.\n');
fprintf('Press a key to start.\n');
KbWait;
WaitSecs(1);
% Open onscreen window with default settings:
screenNumber = max(Screen('Screens'));
[window,screenRect] = Screen('OpenWindow', screenNumber, 0, []);
HideCursor;
% define positions and angles
positionOfMainCircle = [350 250 450 350] ;
startAngle = [0 100 240] ; % the colors red, blue, green start
% at 0, 100, 240 deg
sizeAngle = [100 140 120] ; % the colors red, blue, green end at
% 0+100=100, 100+140=240, 240+120=360 deg
positionOfCover = [345 245 455 355] ; % the cover is in a rectangle a
% little larger than the other arcs
coverStart = 40; % deg
coverAngle = 60; % deg
% define colors
white = WhiteIndex(window) ;
darkgray = white/2.2;
red = [200 0 0] ;
green = [0 200 0] ;
blue = [0 0 200];
% Clear screen to blue background:
Screen('FillRect', window, [0 0 255]);
Screen('Flip', window);
% Draw filled arcs:
Screen('FillArc',window, red,positionOfMainCircle,startAngle(1),sizeAngle(1));
Screen('FillArc',window, blue,positionOfMainCircle,startAngle(2),sizeAngle(2));
Screen('FillArc',window, green,positionOfMainCircle,startAngle(3),sizeAngle(3));
Screen('FillArc',window, darkgray, positionOfCover,coverStart,coverAngle);
% Show it:
Screen('Flip', window);
% Wait for keyboard press:
KbWait;
WaitSecs(1);
% Draw arcs:
Screen('DrawArc',window, red,positionOfMainCircle,startAngle(1),sizeAngle(1));
Screen('DrawArc',window, blue,positionOfMainCircle,startAngle(2),sizeAngle(2));
Screen('DrawArc',window, green,positionOfMainCircle,startAngle(3),sizeAngle(3));
Screen('DrawArc',window, darkgray, positionOfCover,coverStart,coverAngle);
% Show it:
Screen('Flip', window);
% Wait for keyboard press:
KbWait;
WaitSecs(1);
% Draw framed arcs of thickness 5:
Screen('FrameArc',window, red,positionOfMainCircle,startAngle(1),sizeAngle(1), 5);
Screen('FrameArc',window, blue,positionOfMainCircle,startAngle(2),sizeAngle(2), 5);
Screen('FrameArc',window, green,positionOfMainCircle,startAngle(3),sizeAngle(3), 5);
Screen('FrameArc',window, darkgray, positionOfCover,coverStart,coverAngle, 5);
% Show it:
Screen('Flip', window);
% Wait for keyboard press:
KbWait;
% Done. Show cursor and close window.
ShowCursor;
Screen('CloseAll');
catch
% This section is executed in case an error happens in the
% experiment code implemented between try and catch...
ShowCursor;
Screen('CloseAll');
psychrethrow(psychlasterror);
end;
|