- ///+ 0 Declaration\r
- ////Prepare global parameters\r
- Canvas window = new Canvas(Canvas.window);\r
- Image img;\r
- Rectangle centerrect = new Rectangle(10, 10);\r
- int imageHsize = 100;\r
- int imageVsize = 60;\r
- double R, G, B;\r
- ///- 0 Declaration\r
-\r
-\r
-\r
- ///+ 1 Initialize\r
- ////Initialize image and set color to each pixel.\r
- img = new Image(imageHsize, imageVsize); //Allocate offscreen in main memory.\r
- Color col = new Color(0,0,0);\r
- for (int i = 0; i < imageHsize; i++)\r
- {\r
- for (int j = 0; j < imageVsize; j++)\r
- {\r
- ///+ 1.1 set1\r
- ////set colors for each pixels\r
- R = Math.random(1.0) * 0.5; //Set R values. \r
- G = Math.random(1.0) * 0.5; //Set G values.\r
- B = Math.random(1.0) * 0.5; //Set B values. \r
- col.set(R, G, B);\r
- img.pix(i, j, col);\r
- ///- 1.1 set1\r
- centerrect.centering();\r
- }\r
- }\r
+ ///+ 1\r
+ //// Set a window for drawing stimulus\r
+ Canvas window = new Canvas(300, 300); //Create a window. Here, window variables are preset mode.\r
+ // You can write this statement as" Canvas window = new Canvas(Canvas.fullscreen); " for fullscreen mode\r
+ // or as " Canvas window = new Canvas(1024, 768, 32, 60.0); " This statement changes screenmode to 1024 x 768, 32bit color, 60 Hz refresh.\r
+ ///- 1\r