Original Author Paul Laughton, 2011
Page 165
De Re BASIC!
The polygon line width, line color, alpha and fill are determined by previous Gr.color and Gr.set.stroke
commands just like any other drawn object. These attributes are owned by the poly object, not by the
list. If you use the same list in different Gr.poly commands, the color, stroke, etc., may be different.
You can change the polygon (add, delete, or move points) by directly manipulating the list with List
commands. You can change to a different list of points using Gr.Modify with "list" as the tag parameter.
Changes are not visible until the Gr.render command is called.
When you create a polygon with Gr.poly or attach a new list with Gr.modify, the list must have an even
number of values and at least two coordinate pairs (four values). These rules are enforced with run-time
errors. The rules cannot be enforced when you modify the list with List commands. Instead, if you have
an odd number of coordinates, the last is ignored. If you have only one point, Gr.render draws nothing.
The Gr.modify parameters are "x", "y" and "list".
See the Sample Program file, f30_poly, for working examples of Gr.poly.
Groups
You can put graphical objects into groups. A group is a list of graphical objects. When you perform
certain operation on a group, the operation is performed on each object in the group.
You group graphical objects by creating a Group Object on the Display List. You use the group by putting
its object number in a graphics command where you would use any other graphical object number.
In this version of BASIC!, you can use a Group Object in these commands:
Gr.move: moves all of the objects by the same x and y amounts
Gr.hide: hides all of the objects
Gr.show: shows (unhides) all of the objects
Gr.show.toggle: any objects that are showing will be hidden, and any objects that are
hidden will be shown.
You use graphics commands to act on the objects in the group's list. You use the List commands to act
on the list: add objects, count the objects, clear the list, and so on.
Try running this example. Watch as the top circle moves to the right, then the top two, and finally the
top three, as circles are added one-by-one to the list attached to the group.
GR.OPEN ,,,,,1 : GR.COLOR ,255,0,0,2
GR.CIRCLE c1,100,100,40 : GR.CIRCLE c2,100,200,40
GR.CIRCLE c3,100,300,40 : GR.CIRCLE c4,100,400,40
GR.RENDER : PAUSE 1000
% draw four red circles
GR.GROUP g, c1
% create a group with one circle
GR.GET.VALUE g, "list", gList
% get the group's list of objects
GR.MOVE g, 0, 50
% move whole group 0 up/down, 50 right
GR.RENDER : PAUSE 1000
% only one circle moves