2 using namespace Psychlops;
4 void psychlops_main() {
5 Canvas cnvs(Canvas::window);
\r
7 Font font(L"MS P Gothic", 32);
\r
8 Letters let(L"hoge", font);
\r
9 let._zoom_cache = true;
\r
11 Clock after, before;
\r
14 while(!Keyboard::esc.pushed()) {
\r
20 font.size = random(100);
\r
21 //let.setFont(font);
\r
23 let.centering().draw(Color::white);
\r
25 cnvs.var((after-before).at_msec(), 100,100, Color::green);
\r
32 #include <psychlops.h>
33 using namespace Psychlops;
36 class RectLuminance : public ExperimentalMethods::Demo {
39 // Widgets::SequentialScreenshot sc;
41 Psychlops::Rectangle rect;
47 display.set(Canvas::window);
48 gabor = new QuickGabor(10.0, 10.0, 1.0);
50 rect.set(100, 100).centering(0,0);
51 xr.set(100,100).shift(200,200);
52 xr.brush = Stroke(Color::red, 2, Stroke::SOLID);
56 arr.vec = Psychlops::Point(100,50);
59 Independent << bg_lum | "BG Luminance" | 0.0<=itv<=4095 | 128 | 1 , 1;
60 Independent << x | "X" | 0.0<=itv<=4095 | 128 | 1 , 1;
65 while(!Input::get(Keyboard::esc)) {
66 display.clear(Color(bg_lum/4095));
67 (*gabor).centering().draw();
72 arr.draw(Color::white);
73 if(Mouse::left.pressed()) display.var(Mouse::x, 100,100);
82 void psychlops_main() {
83 RectLuminance * exp = new RectLuminance;
92 #include <psychlops.h>
93 using namespace Psychlops;
96 const int DIVISION_MODES = 5;
97 const int MIN_DIVISION_MODES = 5;
98 const double SIGMA_MAGN = 6.0;
102 Canvas display(Canvas::window);
105 double size_whole= 400.0, wl = 30.0;
106 double contrast = 0.5, ori = 0.0, velocity = 15.0;
110 Independent << div | "Division" | 5<=rng<=9 | 1 | 1 ;
111 Independent << wl | "Wavelength" | 30.0<=rng<=60.0 | 5.0 | 1.0 ;
112 Independent << contrast | "Contrast" | 0<=rng<=1.0 | 0.1 | 0.01;
113 Independent << velocity | "Velocity" | -90.0<=rng<=90.0 | 15.0 | 1.0 ;
114 Independent << velmode | "Velocity Mode" | 0<=rng<=1 | 1 | 1 ;
115 Independent << ori | "Orientation" | -360.0<=rng<=720.0 | 30.0 | 15.0;
118 //Formatting and (re)locating Gabors
119 QuickGabor gabor[DIVISION_MODES][DIVISION_MODES+MIN_DIVISION_MODES][DIVISION_MODES+MIN_DIVISION_MODES];
120 for(int divs=0, divs_really=0; divs<DIVISION_MODES; divs++) {
121 divs_really = MIN_DIVISION_MODES+divs;
122 for(int x=0; x<DIVISION_MODES+MIN_DIVISION_MODES; x++) {
123 for(int y=0; y<DIVISION_MODES+MIN_DIVISION_MODES; y++) {
124 each_size = size_whole/divs_really;
125 gabor[divs][x][y].set((wl/(divs_really-y+1)), each_size/SIGMA_MAGN).centering().shift(each_size*((x+0.5)-(divs_really/2.0)), each_size*(divs_really/2.0-(y+0.5)));
126 gabor[divs][x][y].phase = Psychlops::random(360);
134 while(!Input::get(Keyboard::esc)) {
135 Display::clear(Color::gray);
136 divarr = div-MIN_DIVISION_MODES;
138 for(int x=0; x<div; x++) {
139 for(int y=0; y<div; y++) {
140 if(ori>360.0) ori -=360.0; if(ori<0.0) ori+=360.0;
142 //Set Gabor parameters
143 gabor[divarr][x][y].wavelength = wl / pow(4.0/3.0, y);
144 gabor[divarr][x][y].contrast = contrast;
145 gabor[divarr][x][y].orientation = ori;
147 gabor[divarr][x][y].phase += velocity * (1.0*x/div);
149 gabor[divarr][x][y].phase += velocity / gabor[divarr][x][y].wavelength * (1.0*x/div) * 20;
153 gabor[divarr][x][y].draw();
162 void psychlops_main()
165 p.setDesign(Procedure::DEMO);
166 p.setProcedure(&GaborChart);
172 #include <psychlops.h>
173 using namespace Psychlops; // Initially developed with Psychlops Win32 1.0.2 / 20080414
177 void RectLuminance() {
178 Canvas display(1024, 768, Canvas::window, Display::secondary);
182 double rect_size = 100;
183 double rect_lum = 0.5;
186 Psychlops::Rectangle rect(rect_size,rect_size);
190 Independent << rect_size | "Rect Size" | 1< rng< 500 | 10.0 | 2.0 ;
191 Independent << rect_lum | "Rect Luminance" | 0.0<=rng<=1.0 | 0.1 | 0.05;
192 Independent << bg_lum | "BG Luminance" | 0.0<=rng<=1.0 | 0.1 | 0.05;
193 Psychlops::Rectangle drawee(100,100);
196 while(!Input::get(Keyboard::esc)) {
197 Display::clear(bg_lum);
198 rect.resize(rect_size,rect_size).draw(rect_lum);
200 display.var((after-before).at_msec(), 100,100, Color::green);
201 if(Independent[&rect_lum].changed()) display.var((after-before).at_msec(), 100,200, Color::green);
202 drawee.centering().shift(Psychlops::random(100),0).draw(Color::black);
209 void psychlops_main() {
211 p.setDesign(Procedure::DEMO);
212 p.setProcedure(RectLuminance);