-
Notifications
You must be signed in to change notification settings - Fork 1
/
stimBackground.m
79 lines (55 loc) · 1.83 KB
/
stimBackground.m
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
classdef stimBackground
%STIMBACKGROUND Summary of this function goes here
% Detailed explanation goes here
properties
winPtr; % from Psychtoolbox('OpenScreen')
color_wd; % color to paint background (word)
end % properties
properties (Dependent = true)
color_rgb;
end % dependent properties
methods
function obj = stimBackground(varargin)
switch(nargin)
case 0
obj.winPtr = NaN;
obj.color_wd = 'gray';
case 1
obj = stimBackground();
obj.color_wd = varargin{1};
case 2
obj = stimBackground();
obj.winPtr = varargin{1};
obj.color_wd = varargin{2};
end
end % constructor method
function draw(obj, varargin)
% drawBackground(bgColor, winRect, winPtr)
%
% Paints entire screen defined by WINRECT the color BGCOLOR
%
switch(nargin)
case 1
winPtr = obj.winPtr;
color = obj.color_rgb;
case 2
winPtr = varargin{1};
color = obj.color_rgb;
case 3
winPtr = varargin{1};
color = varargin{2};
end % input switch
Screen('FillRect', winPtr, color);
end
function value = get.color_rgb(obj)
value = seColor2RGB(obj.color_wd);
end
function display(obj)
% DISPLAY displays info for STIMBACKGROUND obj
disp(' ');
disp(struct(obj))
disp(sprintf('%s is a %s object', inputname(1), class(obj)))
disp(' ');
end % function
end % methods
end % classdef