4 namespace PsychlopsSilverlight4test
\r
6 public class PsychlopsMain
\r
8 public void psychlops_main()
\r
10 var figure_type = Psychlops.Widgets.Browser.Element.byID("FIGURE");
\r
11 var size_x = Psychlops.Widgets.Browser.Element.byID("SIZE_X");
\r
12 var size_y = Psychlops.Widgets.Browser.Element.byID("SIZE_Y");
\r
13 var shift_x = Psychlops.Widgets.Browser.Element.byID("SHIFT_X");
\r
14 var shift_y = Psychlops.Widgets.Browser.Element.byID("SHIFT_Y");
\r
15 var color_r = Psychlops.Widgets.Browser.Element.byID("COLOR_R");
\r
16 var color_g = Psychlops.Widgets.Browser.Element.byID("COLOR_G");
\r
17 var color_b = Psychlops.Widgets.Browser.Element.byID("COLOR_B");
\r
19 Canvas window = new Canvas(300, 300);
\r
21 var figure_r = new Rectangle();
\r
22 var figure_e = new Ellipse();
\r
23 Shape figure = figure_r;
\r
25 while (!Keyboard.esc.pushed())
\r
27 if (System.String.Compare(figure_type, "Rectangle") == 0)
\r
29 figure_r.set(size_x, size_y);
\r
34 figure_e.set(size_x, size_y);
\r
37 figure.fill = new Color(color_r, color_g, color_b);
\r
39 window.clear(Color.black);
\r
40 figure.centering().shift(shift_x, shift_y).draw();
\r
56 public class RandomDots
\r
59 public Point[] cood;
\r
62 cood = new Point[250];
\r
63 dot = new Rectangle(5, 5);
\r
67 dot.fill = Color.white;
\r
68 foreach (Point p in cood)
\r
70 dot.centering(p).draw();
\r
78 namespace PsychlopsSilverlight4test
\r
81 public class PsychlopsMain
\r
93 public void psychlops_main()
\r
95 cnvs = new Canvas(500, 500);
\r
96 img = new Image(isize * 2, isize * 2);
\r
97 fixation = new Rectangle(10, 10);
\r
98 fixation.fill = Color.red;
\r
99 //var poly = new Rectangle(100, 100);
\r
100 var poly = new Letters("日本語");
\r
101 //var poly = new Polygon(); poly.append(0, 100); poly.append(-100, 0); poly.append(0, -100); poly.append(100, 0);
\r
102 //var poly = new Ellipse(100, 100);
\r
103 //var poly = new Line(0,0,100, 0);
\r
104 poly.fill = Color.red;
\r
105 poly.stroke = new Stroke { color = Color.yellow, thick = 1 };
\r
108 var rng = new Interval();
\r
109 var slider = new Psychlops.Widgets.Slider("tesrt", 0 <= rng <= 5);
\r
111 dots = new RandomDots();
\r
117 cnvs.clear(new Color(Mouse.left.pressed() ? 0.75 : 0.5));
\r
118 col.set(Math.random(1.0));
\r
120 fixation.centering();
\r
121 fixation.draw(Color.red);
\r
123 //Figures.drawGabor(ref img, 20, 100, 1, 0, frames * 2.0 * Math.PI / tfreq / 60);
\r
124 //Figures.drawGaussian(ref img, 20, 1);
\r
125 Figures.drawGrating(ref img, 30, 30, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60);
\r
126 img.centering(Mouse.position);
\r
129 shape.centering(Mouse.position).shift(100,0);
\r
131 if (Keyboard.spc.pressed()) cnvs.var(Mouse.x, 100, 100);
\r
133 cnvs.var(frames, 20, 20);
\r
134 slider.value = frames/100.0;
\r
136 fixation.shift(100,100);
\r
137 fixation.draw(new Stroke(Color.blue, 3));
\r
139 for (int i=0; i<dots.cood.Length; i++)
\r
141 dots.cood[i].set(Math.random(500), Math.random(500));
\r