--- /dev/null
+\r
+/*\r
+using Psychlops;\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+\r
+ public class PsychlopsMain\r
+ {\r
+ void RectLuminance()\r
+ {\r
+ Canvas display = new Canvas(Canvas.window);\r
+ Psychlops.Solver.BinomialLikelihood.showWindow(Math.cumulativeNormalDistibution);\r
+ Letters le = new Letters("Reload to restart");\r
+ le.fill = Color.black;\r
+ le.align = Letters.HorizontalAlign.center;\r
+\r
+ while (!Keyboard.esc.pushed())\r
+ {\r
+ Display.clear(Color.white);\r
+ le.centering().shift(-200,-10).draw();\r
+ Display.flip();\r
+ }\r
+\r
+ }\r
+\r
+\r
+ public void psychlops_main()\r
+ {\r
+ RectLuminance();\r
+ }\r
+\r
+\r
+ }\r
+\r
+}\r
+\r
+*/\r
+\r
+\r
+\r
+/*\r
+using Psychlops;\r
+\r
+namespace PsychlopsSilverlightApp\r
+{\r
+\r
+ public class PsychlopsMain\r
+ {\r
+\r
+ Psychlops.Widgets.Slider rect_size, freq, contrast;\r
+\r
+ void PositionalBiasisInMovingGabor()\r
+ {\r
+ double vel = 30.0;\r
+ double StimWidth = 120;\r
+\r
+ Interval rng = new Interval();\r
+ Psychlops.Widgets.Slider rect_size, freq, contrast;\r
+ rect_size = new Psychlops.Widgets.Slider("Rect Size", 1 < rng < 500, 120.0);\r
+ freq = new Psychlops.Widgets.Slider("Sptial Frequency", 0.0 <= rng <= 1.0, 0.125);\r
+ contrast = new Psychlops.Widgets.Slider("Contrast", 0.0 <= rng <= 1.0, 0.1);\r
+\r
+ int IMAGES = (int)vel;\r
+\r
+ Image[] GaborIMG = new Image[200];\r
+ for (int i = 0; i < 200; i++) GaborIMG[i] = new Image();\r
+\r
+ Color clrcol = new Color(), clrFP = new Color();\r
+ Display.clear(0.5);\r
+ clrcol.set(128.0 / 255.0);\r
+ clrFP.set(128.0 / 255.0, 0.0, 0.0);\r
+\r
+ int phase = 0;\r
+ double distance = rect_size;\r
+ bool changed = true, stop = false;\r
+ double prev_contrast = 0.0, prev_freq = 0.0, prev_size = 0.0;\r
+\r
+ while (!Keyboard.esc.pushed())\r
+ {\r
+ Display.clear();\r
+\r
+ if (prev_contrast != contrast || prev_freq != freq || prev_size != rect_size) changed = true;\r
+ prev_contrast = contrast;\r
+ prev_freq = freq;\r
+ prev_size = rect_size;\r
+ if (changed)\r
+ {\r
+ for (int i = 0; i < 2; i++)\r
+ {\r
+ for (int j = 0; j < IMAGES; j++)\r
+ {\r
+ Figures.drawGabor(ref GaborIMG[i * IMAGES + j], rect_size / 8.0, freq, contrast, Math.PI * 0.5, 2.0 * Math.PI * j / IMAGES);\r
+ distance = rect_size;\r
+ }\r
+ }\r
+ changed = false;\r
+ }\r
+\r
+ if (!stop)\r
+ {\r
+ Display.clear(127.0 / 255.0);\r
+ for (int i = 0; i < 3; i++)\r
+ {\r
+ switch (i)\r
+ {\r
+ case 0:\r
+ GaborIMG[IMAGES - phase - 1].centering().shift(0, -distance);\r
+ GaborIMG[IMAGES - phase - 1].draw(); break;\r
+ case 1:\r
+ GaborIMG[phase].centering().shift(0, 0);\r
+ GaborIMG[phase].draw(); break;\r
+ case 2:\r
+ GaborIMG[IMAGES - phase - 1].centering().shift(0, +distance);\r
+ GaborIMG[IMAGES - phase - 1].draw(); break;\r
+ }\r
+ }\r
+ }\r
+ if (Keyboard.spc.pushed()) stop = !stop;\r
+ //GaborIMG[0].draw();\r
+\r
+ phase++;\r
+ phase %= IMAGES;\r
+ //if (!stop) Display.flip();\r
+ Display.flip();\r
+\r
+ }\r
+\r
+ }\r
+\r
+\r
+ public void psychlops_main()\r
+ {\r
+\r
+ Canvas display = new Canvas(Canvas.window);\r
+\r
+ PositionalBiasisInMovingGabor();\r
+\r
+ }\r
+\r
+\r
+\r
+ }\r
+\r
+}\r
+ */\r
+/*\r
+ * \r
+ * using Psychlops;\r
+\r
+namespace PsychlopsSilverlightApp\r
+{\r
+\r
+ public class PsychlopsMain\r
+ {\r
+\r
+ Psychlops.Canvas cnvs;\r
+ int i;\r
+ double x, y, z, t, p, temp, xx, yy;\r
+\r
+ //Set Target Initial Value\r
+ double TargetEcce = 100.0, TargetSize = 5.0, TargetNumber = 5, Rotate = 0.0;\r
+\r
+ //Set Background Initial Value\r
+ double Axis = 0.0, BGRadii = 150, BGSize = 5.0;\r
+ Psychlops.Widgets.Slider thetaSpeed, DotNumber;\r
+ Image img;\r
+\r
+\r
+\r
+ public void psychlops_main()\r
+ {\r
+\r
+ cnvs = new Canvas(500, 500);\r
+\r
+// Psychlops.Solver.BinomialLikelihood.showWindow(Math.cumulativeNormalDistibution);\r
+// img = new Image("Resources/logo.png");\r
+\r
+ Interval rng = new Interval();\r
+ thetaSpeed = new Psychlops.Widgets.Slider("Label", -10 <= rng <= 10, 3.0);\r
+ DotNumber = new Psychlops.Widgets.Slider("DotNum", 0 <= rng <= 100, 50.0);\r
+\r
+ //Declare background dots and target\r
+ Rectangle[] BGDot = new Rectangle[2048];\r
+ for (int i = 0; i < 2048; i++)\r
+ {\r
+ BGDot[i]=new Rectangle();\r
+ }\r
+ Rectangle[] Target= new Rectangle[10];\r
+ for(int i=0; i<10; i++){\r
+ Target[i]=new Rectangle();\r
+ }\r
+\r
+\r
+\r
+ //Declare Matrix to keep back ground dots' coordinate value\r
+ double[] DotX=new double[2048];\r
+ double[] DotY = new double[2048];\r
+\r
+ AppState.statusBar = "dvcscxz";\r
+ //Set Independent variables to manipulate\r
+\r
+\r
+ //Initialize positions of background dots\r
+ for(int i=0; i<2048; i++){\r
+ t=2.0*Math.PI*Math.random(1.0);\r
+ p=2.0*Math.PI*Math.random(1.0);\r
+ DotX[i]=t;\r
+ DotY[i]=p;\r
+\r
+ x=BGRadii*Math.cos(t)*Math.cos(p);\r
+ y=BGRadii*Math.sin(t)*Math.cos(p);\r
+ BGDot[i].set(BGSize, BGSize);\r
+ BGDot[i].centering().shift(x,y);\r
+ }\r
+\r
+ //Initialize positions of targets\r
+ for(int i=0; i<10; i++)Target[i].set(TargetSize, TargetSize);\r
+\r
+ double COS, SIN;\r
+ //DotNumber = 200;\r
+ //Main stimulus loop\r
+ while(true){\r
+ //Clear the main window\r
+ cnvs.clear();\r
+\r
+\r
+ temp=Axis/360*2*Math.PI;\r
+ COS=Math.cos(temp);\r
+ SIN=Math.sin(temp);\r
+\r
+ //Calculate positions of background dots and set them\r
+ for(int i=0; i<DotNumber; i++){\r
+ //Calculate in polar coordinate\r
+ t=DotX[i]+2.0*Math.PI*thetaSpeed/360.0;\r
+ p=DotY[i];\r
+\r
+ //Save current position\r
+ DotX[i]=t;\r
+\r
+ //Convert to Decartes coordinate\r
+ x=BGRadii*Math.cos(t)*Math.cos(p);\r
+ y=BGRadii*Math.sin(t)*Math.cos(p);\r
+ z=BGRadii*Math.sin(p);\r
+ xx=x;\r
+ yy=SIN*y+COS*z;\r
+\r
+ //Set Dotsize and Draw them\r
+ BGDot[i].set(BGSize, BGSize);\r
+ BGDot[i].centering().shift(xx,yy);\r
+ BGDot[i].draw( Color.blue );\r
+ }\r
+\r
+ //Calculate positions of targets and set them\r
+ temp=Rotate*2*Math.PI/360.0;\r
+ for (int i = 0; i < 5; i++)\r
+ {\r
+ t = 2.0 * Math.PI/TargetNumber;\r
+ x = TargetEcce*Math.cos(i*t+temp);\r
+ y = TargetEcce*Math.sin(i*t+temp);\r
+ Target[i].centering().shift(x,y);\r
+ Target[i].fill = Color.yellow;\r
+ Target[i].draw();\r
+ }\r
+\r
+ // img.centering(Mouse.position).draw();\r
+\r
+ cnvs.var(Mouse.position.x, 100, 100);\r
+ cnvs.var(Mouse.position.y, 100, 140);\r
+\r
+ //Reflect drawing at the next frame;\r
+ cnvs.flip();\r
+ }\r
+ }\r
+ }\r
+\r
+}\r
+ * */\r
+\r
+\r
+\r
+\r
+\r
+\r
+/*\r
+ using Psychlops;\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+\r
+ public class PsychlopsMain\r
+ {\r
+\r
+ Psychlops.Canvas cnvs;\r
+ int i;\r
+ double x, y, z, t, p, temp, xx, yy;\r
+\r
+ //Set Target Initial Value\r
+ double TargetEcce = 100.0, TargetSize = 5.0, TargetNumber = 5, Rotate = 0.0;\r
+\r
+ //Set Background Initial Value\r
+ double Axis = 0.0, BGRadii = 150, BGSize = 5.0;\r
+ Psychlops.Widgets.Slider thetaSpeed, DotNumber;\r
+ Image img;\r
+\r
+\r
+\r
+ public void psychlops_main()\r
+ {\r
+ cnvs = new Canvas(500, 500);\r
+\r
+ Psychlops.Solver.BinomialLikelihood.showWindow(Math.cumulativeNormalDistibution);\r
+\r
+\r
+ img = new Image("Resources/logo.png");\r
+\r
+ Interval rng = new Interval();\r
+ thetaSpeed = new Psychlops.Widgets.Slider("Label", -10 <= rng <= 10, 3.0);\r
+ DotNumber = new Psychlops.Widgets.Slider("DotNum", 0 <= rng <= 100, 50.0);\r
+\r
+ //Declare background dots and target\r
+ Rectangle[] BGDot = new Rectangle[2048];\r
+ for(int i=0; i<2048; i++){\r
+ BGDot[i]=new Rectangle();\r
+ }\r
+ Rectangle[] Target= new Rectangle[10];\r
+ for(int i=0; i<10; i++){\r
+ Target[i]=new Rectangle();\r
+ }\r
+\r
+\r
+ //Declare Matrix to keep back ground dots' coordinate value\r
+ double[] DotX=new double[2048];\r
+ double[] DotY = new double[2048];\r
+\r
+\r
+ //Set Independent variables to manipulate\r
+\r
+\r
+ //Initialize positions of background dots\r
+ for(int i=0; i<2048; i++){\r
+ t=2.0*Math.PI*Math.random(1.0);\r
+ p=2.0*Math.PI*Math.random(1.0);\r
+ DotX[i]=t;\r
+ DotY[i]=p;\r
+\r
+ x=BGRadii*Math.cos(t)*Math.cos(p);\r
+ y=BGRadii*Math.sin(t)*Math.cos(p);\r
+ BGDot[i].set(BGSize, BGSize);\r
+ BGDot[i].centering().shift(x,y);\r
+ }\r
+\r
+ //Initialize positions of targets\r
+ for(int i=0; i<10; i++)Target[i].set(TargetSize, TargetSize);\r
+\r
+ double COS, SIN;\r
+ //DotNumber = 200;\r
+ //Main stimulus loop\r
+ while(true){\r
+ //Clear the main window\r
+ cnvs.clear();\r
+\r
+\r
+ temp=Axis/360*2*Math.PI;\r
+ COS=Math.cos(temp);\r
+ SIN=Math.sin(temp);\r
+\r
+ //Calculate positions of background dots and set them\r
+ for(int i=0; i<DotNumber; i++){\r
+ //Calculate in polar coordinate\r
+ t=DotX[i]+2.0*Math.PI*thetaSpeed/360.0;\r
+ p=DotY[i];\r
+\r
+ //Save current position\r
+ DotX[i]=t;\r
+\r
+ //Convert to Decartes coordinate\r
+ x=BGRadii*Math.cos(t)*Math.cos(p);\r
+ y=BGRadii*Math.sin(t)*Math.cos(p);\r
+ z=BGRadii*Math.sin(p);\r
+ xx=x;\r
+ yy=SIN*y+COS*z;\r
+\r
+ //Set Dotsize and Draw them\r
+ BGDot[i].set(BGSize, BGSize);\r
+ BGDot[i].centering().shift(xx,yy);\r
+ BGDot[i].draw( Color.blue );\r
+ }\r
+\r
+ //Calculate positions of targets and set them\r
+ temp=Rotate*2*Math.PI/360.0;\r
+ for (int i = 0; i < 5; i++)\r
+ {\r
+ t = 2.0 * Math.PI/TargetNumber;\r
+ x = TargetEcce*Math.cos(i*t+temp);\r
+ y = TargetEcce*Math.sin(i*t+temp);\r
+ Target[i].centering().shift(x,y);\r
+ Target[i].fill = Color.yellow;\r
+ Target[i].draw();\r
+ }\r
+\r
+ img.centering(Mouse.position).draw();\r
+\r
+ cnvs.var(Mouse.position.x, 100, 100);\r
+ cnvs.var(Mouse.position.y, 100, 140);\r
+\r
+ //Reflect drawing at the next frame;\r
+ cnvs.flip();\r
+ }\r
+ }\r
+ }\r
+\r
+}\r
+*/\r
+\r
+\r
+/*using Psychlops;\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+ public class PsychlopsMain\r
+ {\r
+ public void psychlops_main()\r
+ {\r
+ var figure_type = Psychlops.Widgets.Browser.Element.byID("FIGURE");\r
+ var size_x = Psychlops.Widgets.Browser.Element.byID("SIZE_X");\r
+ var size_y = Psychlops.Widgets.Browser.Element.byID("SIZE_Y");\r
+ var shift_x = Psychlops.Widgets.Browser.Element.byID("SHIFT_X");\r
+ var shift_y = Psychlops.Widgets.Browser.Element.byID("SHIFT_Y");\r
+ var color_r = Psychlops.Widgets.Browser.Element.byID("COLOR_R");\r
+ var color_g = Psychlops.Widgets.Browser.Element.byID("COLOR_G");\r
+ var color_b = Psychlops.Widgets.Browser.Element.byID("COLOR_B");\r
+\r
+ Canvas window = new Canvas(300, 300);\r
+\r
+ var figure_r = new Rectangle();\r
+ var figure_e = new Ellipse();\r
+ Shape figure = figure_r;\r
+ \r
+ while (!Keyboard.esc.pushed())\r
+ {\r
+ if (System.String.Compare(figure_type, "Rectangle") == 0)\r
+ {\r
+ figure_r.set(size_x, size_y);\r
+ figure = figure_r;\r
+ }\r
+ else\r
+ {\r
+ figure_e.set(size_x, size_y);\r
+ figure = figure_e;\r
+ }\r
+ figure.fill = new Color(color_r, color_g, color_b);\r
+\r
+ window.clear(Color.black);\r
+ figure.centering().shift(shift_x, shift_y).draw();\r
+ window.flip();\r
+ }\r
+ }\r
+ }\r
+\r
+}\r
+\r
+\r
+\r
+\r
+/*\r
+using Psychlops;\r
+\r
+namespace Psychlops\r
+{\r
+\r
+ public class RandomDots\r
+ {\r
+ Rectangle dot;\r
+ public Point[] cood;\r
+ public RandomDots()\r
+ {\r
+ cood = new Point[250];\r
+ dot = new Rectangle(5, 5);\r
+ }\r
+ public void draw()\r
+ {\r
+ dot.fill = Color.white;\r
+ foreach (Point p in cood)\r
+ {\r
+ dot.centering(p).draw();\r
+ }\r
+ }\r
+ }\r
+\r
+}\r
+\r
+\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+\r
+ public class PsychlopsMain\r
+ {\r
+ Canvas cnvs;\r
+ Image img;\r
+ Ellipse fixation;\r
+ Shape shape;\r
+ Color col;\r
+ int isize = 100;\r
+ double tfreq = 1;\r
+ int frames;\r
+ RandomDots dots;\r
+ Group g;\r
+\r
+ public void psychlops_main()\r
+ {\r
+ cnvs = new Canvas(500, 500);\r
+ g = new Group();\r
+ img = new Image(isize * 2, isize * 2);\r
+ Figures.drawGrating(ref img, 200, 200, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60);\r
+ g.append(img);\r
+ g.rotation = 50;\r
+ fixation = new Ellipse(10, 10);\r
+ fixation.fill = Color.red;\r
+ //var poly = new Rectangle(100, 100);\r
+ var poly = new Letters("日本語");\r
+ //var poly = new Polygon(); poly.append(0, 100); poly.append(-100, 0); poly.append(0, -100); poly.append(100, 0);\r
+ //var poly = new Ellipse(100, 100);\r
+ //var poly = new Line(0,0,100, 0);\r
+ poly.fill = Color.red;\r
+ poly.stroke = new Stroke { color = Color.yellow, thick = 1 };\r
+ shape = poly;\r
+\r
+ var rng = new Interval();\r
+ var slider = new Psychlops.Widgets.Slider("tesrt", -100 <= rng <= 100);\r
+\r
+ dots = new RandomDots();\r
+\r
+\r
+ while (true)\r
+ {\r
+ frames++;\r
+\r
+\r
+ cnvs.clear(new Color(Mouse.left.pressed() ? 0.75 : 0.5));\r
+ col.set(Math.random(1.0));\r
+\r
+ /*if (frames % 2 == 0)\r
+ {\r
+ fixation.centering().shift(100, 100);\r
+ fixation.draw(new Stroke(Color.blue, 3));\r
+ }* /\r
+\r
+ fixation.centering().shift(slider, 0);\r
+ fixation.draw(Color.red);\r
+\r
+ //Figures.drawGabor(ref img, 20, 100, 1, 0, frames * 2.0 * Math.PI / tfreq / 60);\r
+ //Figures.drawGaussian(ref img, 20, 1);\r
+ //Figures.drawGrating(ref img, 200, 200, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60);\r
+ //img.centering(Mouse.position);\r
+ //img.draw();\r
+ g.centering(Mouse.position).draw();\r
+ g.rotation += 1;\r
+\r
+ shape.centering(Mouse.position).shift(100, 0);\r
+ shape.draw();\r
+ if (Keyboard.spc.pressed()) cnvs.var(Mouse.x, 100, 100);\r
+\r
+ cnvs.var(frames, 0, 20);\r
+ //slider.value = frames / 100.0;\r
+\r
+ /*if (frames % 2 != 0)\r
+ {\r
+ fixation.shift(100, 100);\r
+ fixation.draw(new Stroke(Color.green, 3));\r
+ }* /\r
+\r
+ for (int i = 0; i < dots.cood.Length; i++)\r
+ {\r
+ dots.cood[i].set(Math.random(500), Math.random(500));\r
+ }\r
+ cnvs.var((double)slider, 200, 200);\r
+ dots.draw();\r
+\r
+ cnvs.flip();\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+**/\r
+\r
+\r
+/*\r
+\r
+using Psychlops;\r
+namespace PsychlopsSilverlight4test\r
+{\r
+\r
+ public class PsychlopsMain\r
+ {\r
+ Canvas cnvs;\r
+ Rectangle[] rect;\r
+ int n;\r
+\r
+ public void psychlops_main()\r
+ {\r
+ n = 1;\r
+ cnvs = new Canvas(500, 500);\r
+ rect = new Rectangle[n];\r
+ for (int i = 0; i < n; i++)\r
+ {\r
+ rect[i] = new Rectangle(10, 10);\r
+ rect[i].fill = Color.red;\r
+ }\r
+ Interval rng = new Interval();\r
+ var slider = new Psychlops.Widgets.Slider("Label", -100 <= rng <= 100);\r
+\r
+ while (true)\r
+ {\r
+ cnvs.clear();\r
+ for (int i = 0; i < n; i++)\r
+ {\r
+ rect[i].centering().shift(slider * i*3, i*3).draw();\r
+ }\r
+ cnvs.flip();\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+*/\r
+\r
+/*\r
+using Psychlops;\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+ public class PsychlopsMain\r
+ {\r
+ public void psychlops_main()\r
+ {\r
+ Canvas window = new Canvas(300, 300);\r
+\r
+ var figure_r = new Rectangle();\r
+ var figure_e = new Ellipse();\r
+ figure_r.set(100,100).centering().shift(0, 0);\r
+ figure_e.set(100,100).centering().shift(0, 0);\r
+\r
+ while (!Keyboard.esc.pushed())\r
+ {\r
+ figure_r.fill = new Color(0, 0, 1);\r
+ figure_r.centering(new Point(100,100)).draw();\r
+ figure_e.fill = new Color(1, 0, 0);\r
+ figure_e.centering(new Point(100, 100)).draw();\r
+ window.flip();\r
+ }\r
+ }\r
+ }\r
+\r
+}\r
+\r
+/*\r
+\r
+\r
+\r
+using Psychlops;\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+ public class PsychlopsMain\r
+ {\r
+ public void psychlops_main()\r
+ {\r
+ var figure_type = Psychlops.Widgets.Browser.Element.byID("FIGURE");\r
+ var size_x = Psychlops.Widgets.Browser.Element.byID("SIZE_X");\r
+ var size_y = Psychlops.Widgets.Browser.Element.byID("SIZE_Y");\r
+ var color_r = Psychlops.Widgets.Browser.Element.byID("COLOR_R");\r
+ var color_g = Psychlops.Widgets.Browser.Element.byID("COLOR_G");\r
+ var color_b = Psychlops.Widgets.Browser.Element.byID("COLOR_B");\r
+\r
+ Canvas window = new Canvas(300, 300);\r
+\r
+ var figure_r = new Rectangle();\r
+ var figure_e = new Ellipse();\r
+ figure_r.centering().shift(0, 0);\r
+ figure_e.centering().shift(0, 0);\r
+\r
+ int frame = 0;\r
+ int direction = 1, motion_dir = 1;\r
+\r
+ while (!Keyboard.esc.pushed())\r
+ {\r
+ window.clear();\r
+\r
+ if (frame % 30 == 0)\r
+ {\r
+ direction = direction * -1;\r
+\r
+ }\r
+\r
+ if (frame % 90 == 0)\r
+ {\r
+ motion_dir *= -1;\r
+ }\r
+\r
+ figure_r.resize(figure_r.getWidth() + direction * 1, figure_r.getHeight() + direction * 1);\r
+ figure_r.shift(motion_dir * 1, 0);\r
+ figure_r.fill = new Color(color_r, color_g, color_b);\r
+\r
+ figure_e.resize(figure_e.getWidth() + direction * 1, figure_e.getHeight() + direction * 1);\r
+ figure_e.shift(motion_dir * 1, 0);\r
+ figure_e.fill = new Color(color_r, color_g, color_b);\r
+\r
+ if (System.String.Compare(figure_type, "Rectangle") == 0)\r
+ {\r
+ figure_r.draw();\r
+ }\r
+ else\r
+ {\r
+ figure_e.draw();\r
+ }\r
+\r
+\r
+ frame++;\r
+\r
+\r
+ window.flip();\r
+ }\r
+ }\r
+ }\r
+\r
+}\r
+ * */\r
+\r
+\r
+/*\r
+using Psychlops;\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+ public class PsychlopsMain\r
+ {\r
+ public void psychlops_main()\r
+ {\r
+ var figure_type = Psychlops.Widgets.Browser.Element.byID("FIGURE");\r
+ var size_x = Psychlops.Widgets.Browser.Element.byID("SIZE_X");\r
+ var size_y = Psychlops.Widgets.Browser.Element.byID("SIZE_Y");\r
+ var shift_x = Psychlops.Widgets.Browser.Element.byID("SHIFT_X");\r
+ var shift_y = Psychlops.Widgets.Browser.Element.byID("SHIFT_Y");\r
+ var color_r = Psychlops.Widgets.Browser.Element.byID("COLOR_R");\r
+ var color_g = Psychlops.Widgets.Browser.Element.byID("COLOR_G");\r
+ var color_b = Psychlops.Widgets.Browser.Element.byID("COLOR_B");\r
+\r
+ Canvas window = new Canvas(300, 300);\r
+\r
+ var figure_r = new Rectangle();\r
+ var figure_e = new Ellipse();\r
+ Shape figure = figure_r;\r
+ \r
+ while (!Keyboard.esc.pushed())\r
+ {\r
+ if (System.String.Compare(figure_type, "Rectangle") == 0)\r
+ {\r
+ figure_r.set(size_x, size_y);\r
+ figure = figure_r;\r
+ }\r
+ else\r
+ {\r
+ figure_e.set(size_x, size_y);\r
+ figure = figure_e;\r
+ }\r
+ figure.fill = new Color(color_r, color_g, color_b);\r
+\r
+ window.clear(Color.black);\r
+ figure.centering().shift(shift_x, shift_y).draw();\r
+ window.flip();\r
+ }\r
+ }\r
+ }\r
+\r
+}\r
+*/\r
+\r
+\r
+/*\r
+using Psychlops;\r
+\r
+namespace Psychlops\r
+{\r
+\r
+ public class RandomDots\r
+ {\r
+ Rectangle dot;\r
+ public Point[] cood;\r
+ public RandomDots()\r
+ {\r
+ cood = new Point[250];\r
+ dot = new Rectangle(5, 5);\r
+ }\r
+ public void draw()\r
+ {\r
+ dot.fill = Color.white;\r
+ foreach (Point p in cood)\r
+ {\r
+ dot.centering(p).draw();\r
+ }\r
+ }\r
+ }\r
+\r
+}\r
+\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+\r
+ public class PsychlopsMain\r
+ {\r
+ Canvas cnvs;\r
+ Image img;\r
+ Rectangle fixation;\r
+ Shape shape;\r
+ Color col;\r
+ int isize = 100;\r
+ double tfreq = 1;\r
+ int frames;\r
+ RandomDots dots;\r
+\r
+ public void psychlops_main()\r
+ {\r
+ cnvs = new Canvas(500, 500);\r
+ img = new Image(isize * 2, isize * 2);\r
+ fixation = new Rectangle(10, 10);\r
+ fixation.fill = Color.red;\r
+ //var poly = new Rectangle(100, 100);\r
+ var poly = new Letters("日本語");\r
+ //var poly = new Polygon(); poly.append(0, 100); poly.append(-100, 0); poly.append(0, -100); poly.append(100, 0);\r
+ //var poly = new Ellipse(100, 100);\r
+ //var poly = new Line(0,0,100, 0);\r
+ poly.fill = Color.red;\r
+ poly.stroke = new Stroke { color = Color.yellow, thick = 1 };\r
+ shape = poly;\r
+\r
+ var rng = new Interval();\r
+ var slider = new Psychlops.Widgets.Slider("tesrt", 0 <= rng <= 5);\r
+\r
+ dots = new RandomDots();\r
+\r
+\r
+ while(true) {\r
+ frames++;\r
+ \r
+ cnvs.clear(new Color(Mouse.left.pressed() ? 0.75 : 0.5));\r
+ col.set(Math.random(1.0));\r
+\r
+ fixation.centering();\r
+ fixation.draw(Color.red);\r
+\r
+ //Figures.drawGabor(ref img, 20, 100, 1, 0, frames * 2.0 * Math.PI / tfreq / 60);\r
+ //Figures.drawGaussian(ref img, 20, 1);\r
+ Figures.drawGrating(ref img, 30, 30, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60);\r
+ img.centering(Mouse.position);\r
+ img.draw();\r
+\r
+ shape.centering(Mouse.position).shift(100,0);\r
+ shape.draw();\r
+ if (Keyboard.spc.pressed()) cnvs.var(Mouse.x, 100, 100);\r
+\r
+ cnvs.var(frames, 20, 20);\r
+ slider.value = frames/100.0;\r
+\r
+ fixation.shift(100,100);\r
+ fixation.draw(new Stroke(Color.blue, 3));\r
+\r
+ for (int i=0; i<dots.cood.Length; i++)\r
+ {\r
+ dots.cood[i].set(Math.random(500), Math.random(500));\r
+ }\r
+ dots.draw();\r
+\r
+ cnvs.flip();\r
+ }\r
+ }\r
+ }\r
+\r
+}\r
+*/
\ No newline at end of file