![]()
Online Tutorial - Introduction to the 2d graphics
| Objectives | Objects and operations with graphics. 2D-visualization. | ||||||||||||||||||
| Main information | The objects for working with 2D-graphics are in the library GRAPH2D.LIB.
These are a line, a polyline, a text, a raster picture, a triangle, a rectangle etc. To
work with these objects the window that can be created by object LGSpace
or GraphicSpace is needed. To get the window with the object you need use
the variables HSpace or WindowName. But it is necessary to do that only in case when
several windows are open. If only one window is open the images work automatically. All
objects have the following variables:
|
||||||||||||||||||
| Exercise 1 | Start Stratum 2000 and create a new project. Insert the GraphicSpace
object (library Unit). Then insert the Rectangle object (library Graph2d).
Set variable values x,y (the coordinates of the top left angle) and the Width,
Height. Set a line and filling color (PencColor, BrushColor). Then
press the Start button
Then try to change the variables values x, y, Width, Height, Pencolor, Brushcolor without stopping the scheme. |
||||||||||||||||||
| Exercise 2 | Insert the object Ellipse. Set
the coordinates, radiuses and other variables. Put the object Arrow, Pie,
Triangle, Picture on the scheme too. Use help to get the
variables description. For that right-click on the object, you are interested in, on the
scheme and choose the line Help on class. Let the scheme run after a new
image was set. Do not forget to press the Stop button |
||||||||||||||||||
| Create a new object and type the formula
describing the object moving on the plane there. For example: x:=100+80*sin(t) Give its variables x and y to the object Rectangle.
Try to control the color. For that type in the created object: color:= RGB(rnd(255), rnd(255), rnd(255)) Give the variable color to the variable Brushcolor of object Rectangle. Try to type the formula changing color under the certain function. Invent yourself some mathematical functions to change the variables of different graphical objects (the line width, the fill or border color, the points coordinates). Insert object Polyline to plot a graph of any mathematical depending or to map the moving trajectory. (for example you can link its variables x and y with the same of object Rectangle). |
|||||||||||||||||||
| Exercise 3 | Try to control any graphical image variables with the help of images VSlider and Hslider (library Control). |
Back : Index : Forward
Trademarks & Copyright © 1998 Stratum Modeling Group. Last modified on 6-January-1999.