Graphic+Rendering

Graphic Rendering
See the excerpt from the Run BASIC documentation on graphics at the bottom of this page.

Graphic objects must be rendered to be displayed on the page. The graphics are drawn in memory and added to the page with the **RENDER** command.

Many copies of a graphic object can appear on the page at the same time. Each time a graphic object is rendered, it is displayed with its most recently added graphics.

A CLS command will remove the display of a graphic object. Run the following code as it is written. You'll see that the graphic object with handle #g is rendered in green, and rendered again in pink. It looks like this:



If the CLS statement is activated, only the most recently rendered graphic object is displayed. Try it both ways and see.

code format="vbnet" 'Create a graphic object with 'handle #g and size 100x100: graphic #g, 100,100

'Fill graphic object with green:
 * 1) g fill("green")

'Cause graphic object to be displayed 'on the webpage: render #g

'To remove the green graphic, 'activate the following CLS statement. 'cls

'Fill graphic object with pink:
 * 1) g fill("pink")

'Cause a second copy of thebgraphic object 'to be displayed on the webpage: render #g

code

 Run BASIC has an easy graphics system. You can draw graphics and then just insert them into a page using the RENDER statement.
 * Graphics** //from the Run BASIC documentation//

Here is a simple example: code graphic #counting, 100, 100 #counting size(5) for x = 1 to 10 #counting set(x*10, x*x) next x render #counting end code This program draws 10 small 5 pixel large black bloxes on a curve. You can render more than one graphic in your program's output. For example if I move the RENDER statement inside the loop as below there will be 10 different graphic images displayed on the web page. code graphic #counting, 100, 100 for x = 1 to 10 print "graphic "; x render #counting next x end code
 * 1) counting size(5)
 * 1) counting set(x*10, x*x)