7.1 The Picture List

The concept Picture is a specialization of the concept GraphicalObject. The reason for this specialization is that the picture defines a list attribute consisting of graphical objects. Due to the specialization, the picture is also a graphical object, and can be added to the list of graphical objects in another Picure. The effect of this design is that every object in the list can be treated in an uniform way, without consideration to the actual type of the object. This is a very elegant foundation for Graphics Modelling.

The graphical objects are stacked (the hexagon being the front most graphical object):

Stacking graphical objects:

[1kb 81x44 GIF]
[45 bytes 50x5 GIF]

Resulting image:

[1kb 94x41 GIF]

When the graphical objects in the list are drawn in a canvas, each object is put on top of the other objects already drawn. Hence the graphical objects in the list are stacked relative to each other on the canvas with respect to their positions in the list. In other words, the last object in the list is the front most object on the canvas and the first object is the lowest object on the canvas. Objects in the end of the list may therefore cover other objects earlier in the list, depending of the positions of the objects. The position in the list is therefore important when a graphical object is manipulated interactively. The subject of interaction is discussed separately in Interaction.

There are several operations to manipulate the list of graphics objects and pictures. Two operations are used to add and delete objects to/from the list:

Takes a graphical object as argument and adds it to the end of the picture list.
Takes a graphical object as argument and deletes it from the picture list.

Two operations support moving the graphical objects relative to the other objects in the list:

Accomplished by moving the object to the last position in the list.
Takes a graphical object as argument and draws the object at the bottom of the canvas. Accomplished by moving the object to the first position in the list.

Two operations support queries to the graphical objects in the list.

FirstContaining and LastContaining.
Takes a point (in CCS) as argument, and reports the first or last object containing the point or NONE.

Finally, two operations support scanning through the graphical objects of the picture.

Scans through all the graphical objects in the picture, in the order of the list.
Scans through all graphical objects of the picture in the opposite order than the list, i.e. from 'top' to 'bottom' of the picture.

The Bifrost Graphics System - Reference Manual
© 1991-2004 Mjølner Informatics
[Modified: Tuesday October 24th 2000 at 15:02]