6.2 Operations

Most of the operations in the graphical object manipulate, or use operations implemented in the shape or the paint. The only exceptions to this fact is manipulation of the transformation matrix and some administration (init and copy) operations.

Init.
Initializes the GraphicalObject by instantiating a shape and a transformation matrix. Init must be called as the first operation on the graphical object. If the graphical object is evaluated, init is called automatically.

To manipulate the shape and the paint of the graphical object four operations are given:

SetShape and GetShape.
Operations to set and get the shape.
SetPaint and GetPaint.
Operations to set and get the paint.

6.2.1 Geometric Transformations

Six operations support geometric transformations on graphical objects: [5]

Move.
Enters two displacements (tx,ty) and moves the graphical object relative to its current position.
MoveTo.
Enters point and moves the hotspot of the graphical object to the point.
Scale.
Enters two scaling factors (sx,sy) and scales the graphical object relative from its current size.
Rotate.
Enters an angle (in degrees) and rotates the graphical object relative to the origin.

6.2.2 Query Operations

HitControl.
Takes a point (in CCS) as argument and returns a reference to the exact point (in GraphicalObject coordinates), if it is in the neighborhood [6] of a control point of the shape of the graphical object. Otherwise returns NONE.
ContainsPoint:
Takes a point (in CCS) as argument and returns true if it is inside the shape of the graphical object.

6.2.3 Interaction

InteractiveCreateShape.
Calls InteractiveCreate of the shape, see Interaction.
InteractiveReshape.
Calls InteractiveReshape of the shape, see Interaction.
InteractiveCombineShape.
Calls InteractiveCombine of the shape, see Interaction.
InteractiveMove.
Takes a canvas, a starting point and a modifier description as argument and interactively moves the graphical object using the interaction handler of the canvas, see Interaction. Calls Move to do the transformation after the interaction has ended.
Hilite.
Makes the graphical object appear highlighted by using the highlighting operation of the shape. When the graphical object is redrawn (by canvas updating) the graphical object will be drawn highlighted.
UnHilite.
Unhighlights the graphical object.

The Hilite and UnHilite operations changes the Canvas' drawing mode to be XOR, to allow for immediate feedback, and invoke an instance of a virtual drawHilite attribute. Thus the feedback may be augmented by further binding this attribute, see Interaction for more details.

6.2.4 Drawing Graphical Objects

A graphical object is drawn on a canvas by calling the Draw operation of the canvas, see The Canvas. The graphical objects then becomes part of the list of graphical objects in the canvas, and the canvas asks the graphical object to draw itself on the canvas. The graphical objects uses its Draw operation to do the actual drawing in the Canvas.

When a Canvas needs to be redrawn, the Canvas knows which graphical objects are drawn in the Canvas, and can therefore ask the graphical objects in question to redraw themselves on the Canvas. Likewise a graphical object is erased by calling the Erase operation of the Canvas. See The Canvas for a complete description of the Canvas and when it must be redrawn.

6.2.5 Transforming Graphical Objects

A graphical object can be transformed by manipulating the transformation matrix TM of the graphical object. Such a transformation will affect the appearance of the graphical object, if it is drawn in a Canvas. To simplify transformation of graphical object, the Transform attribute is present:

Transform.
Applies a matrix to the transformation matrix of the graphical object. To be precise,
aMatrix[] -> anAbstractGraphicalObject.transform;
is equivalent with
(anAbstractGraphicalObject.TM, aMatrix[])
  -> MatrixMul -> anAbstractGraphicalObject.TM;

Notice, that in general, only instances of Shape are guarantied to be transformable, in particular some of the Predefined Graphical Objects (see later) will not respond correctly to all transformations. Translations, i.e. linear moving, however, will work for all kinds of graphical objects. Pictures (see below) may also be transformed, but if they contain Predefined Graphical Objects, the restrictions mentioned above apply to the Picture itself too.


[5] Geometric transformations are described in Coordinate Systems and Transformations
[6] See Neighborhood for a definition of the concept neighborhood


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