2 ///+ Prefix linkto BasicCode1
\r
3 //// Lines for set up Psychlops environment
\r
6 namespace PsychlopsSilverlightApp
\r
9 public class PsychlopsMain
\r
10 {///- Prefix linkto BasicCode1
\r
14 //// Psychlops runs at the first line of this function psychlops_main().
\r
15 public void psychlops_main()
\r
18 ////Prepare global parameters
\r
19 Canvas window = new Canvas(Canvas.window);
\r
21 Rectangle centerrect = new Rectangle(10, 10);
\r
22 int imageHsize = 100;
\r
23 int imageVsize = 60;
\r
30 ////Initialize image and set color to each pixel.
\r
31 img = new Image(imageHsize, imageVsize); //Allocate offscreen in main memory.
\r
32 Color col = new Color(0,0,0);
\r
33 for (int i = 0; i < imageHsize; i++)
\r
35 for (int j = 0; j < imageVsize; j++)
\r
38 ////set colors for each pixels
\r
39 R = Math.random(1.0) * 0.5; //Set R values.
\r
40 G = Math.random(1.0) * 0.5; //Set G values.
\r
41 B = Math.random(1.0) * 0.5; //Set B values.
\r
45 centerrect.centering();
\r
49 //img.cache(); //Move offscreen from main memory to video RAM. (Optional)
\r
53 ////drawing offscreen
\r
55 while (!Keyboard.esc.pushed())
\r
58 window.clear(Color.black); //Clear screen with black
\r
59 img.centering(); //centering the position to copy offscreen
\r
60 img.shift(100, 100); //centering the position to copy offscreen
\r
61 img.draw(); // copy offscreen onto the reverse side of window buffer.
\r
62 centerrect.draw(Color.red);// draw reference rectangle at the center.
\r