5 namespace PsychlopsSilverlight4test
\r
7 public class PsychlopsMain
\r
9 public void psychlops_main()
\r
11 var figure_type = Psychlops.Widgets.Browser.Element.byID("FIGURE");
\r
12 var size_x = Psychlops.Widgets.Browser.Element.byID("SIZE_X");
\r
13 var size_y = Psychlops.Widgets.Browser.Element.byID("SIZE_Y");
\r
14 var shift_x = Psychlops.Widgets.Browser.Element.byID("SHIFT_X");
\r
15 var shift_y = Psychlops.Widgets.Browser.Element.byID("SHIFT_Y");
\r
16 var color_r = Psychlops.Widgets.Browser.Element.byID("COLOR_R");
\r
17 var color_g = Psychlops.Widgets.Browser.Element.byID("COLOR_G");
\r
18 var color_b = Psychlops.Widgets.Browser.Element.byID("COLOR_B");
\r
20 Canvas window = new Canvas(300, 300);
\r
22 var figure_r = new Rectangle();
\r
23 var figure_e = new Ellipse();
\r
24 Shape figure = figure_r;
\r
26 while (!Keyboard.esc.pushed())
\r
28 if (System.String.Compare(figure_type, "Rectangle") == 0)
\r
30 figure_r.set(size_x, size_y);
\r
35 figure_e.set(size_x, size_y);
\r
38 figure.fill = new Color(color_r, color_g, color_b);
\r
40 window.clear(Color.black);
\r
41 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
79 namespace PsychlopsSilverlight4test
\r
82 public class PsychlopsMain
\r
94 public void psychlops_main()
\r
96 cnvs = new Canvas(500, 500);
\r
97 img = new Image(isize * 2, isize * 2);
\r
98 fixation = new Rectangle(10, 10);
\r
99 fixation.fill = Color.red;
\r
100 //var poly = new Rectangle(100, 100);
\r
101 var poly = new Letters("日本語");
\r
102 //var poly = new Polygon(); poly.append(0, 100); poly.append(-100, 0); poly.append(0, -100); poly.append(100, 0);
\r
103 //var poly = new Ellipse(100, 100);
\r
104 //var poly = new Line(0,0,100, 0);
\r
105 poly.fill = Color.red;
\r
106 poly.stroke = new Stroke { color = Color.yellow, thick = 1 };
\r
109 var rng = new Interval();
\r
110 var slider = new Psychlops.Widgets.Slider("tesrt", 0 <= rng <= 5);
\r
112 dots = new RandomDots();
\r
119 cnvs.clear(new Color(Mouse.left.pressed() ? 0.75 : 0.5));
\r
120 col.set(Math.random(1.0));
\r
122 fixation.centering();
\r
123 fixation.draw(Color.red);
\r
125 //Figures.drawGabor(ref img, 20, 100, 1, 0, frames * 2.0 * Math.PI / tfreq / 60);
\r
126 //Figures.drawGaussian(ref img, 20, 1);
\r
127 Figures.drawGrating(ref img, 30, 30, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60);
\r
128 img.centering(Mouse.position);
\r
131 shape.centering(Mouse.position).shift(100, 0);
\r
133 if (Keyboard.spc.pressed()) cnvs.var(Mouse.x, 100, 100);
\r
135 cnvs.var(frames, 20, 20);
\r
136 slider.value = frames / 100.0;
\r
138 fixation.shift(100, 100);
\r
139 fixation.draw(new Stroke(Color.blue, 3));
\r
141 for (int i = 0; i < dots.cood.Length; i++)
\r
143 dots.cood[i].set(Math.random(500), Math.random(500));
\r