9.8 Defining New Shapes

Predefined graphical objects are defined by describing a shape that defines the outline of the object. This is done in two steps. First, the additional attributes that specifies the shape are defined, e.g to define a line shape, the shape defines three attributes: two end points and a line width. Secondly, the operation GetShape, that calculates the actual shape in terms of line and spline segments, is defined.

In practice it could be very difficult or impossible to define the GetShape operation, e.g. for text. In case the application programmer wants to utilize special hardware/firmware operations, the Draw and Erase operations of the graphical object must be specialized together with a corresponding fill operation of the Paint (cf. Predefined Paint Operations).

In case GetShape is not written for a particular predefined graphical object, the following operations must be further bound in the predefined shape:

Return the enclosing rectangle of the shape.
Determine whether the entered point is inside the shape.
Determine whether the shape of the entered graphical object intersects the shape
Determine whether the shape of the entered graphical object is totally inside the shape
Transform all points of the shape by the transformation matrix.
Determine whether the entered point is in the neighborhood of one of the control points of the shape. See Neighborhood for a definition of neighborhood.
InteractiveCreate and InteractiveReshape.
Specify how to interactively create and reshape the shape. See also Interaction.
HiliteControls, HiliteOutline, HiliteBound
Specify how to highlight the shape by using control points, the outline, or the bounding box, respectively, of the shape. See also Interaction.

9.8.1 Predefined Paint Operations

When a graphical object is rendered on a drawing surface, it is the responsibility of the paint of the graphical object to do the actual displaying. As stated in The Paint, the rendering is accomplished by filling out a shape. Thus any paint has an operation FillShape that enters the shape to be filled.

To utilize the capacity of the basic graphics system a predefined shape can be drawn using a different approach. The shapes in question here could be lines with the minimal line width the output device can display, ellipses, arcs, and text.

To allow an efficient implementation of the fill operations Bifrost therefore supplies some additional filling operations for these special cases. These additional operations are only a supplement, the basic filling operation FillShape, must be able to handle all shapes. Bifrost supply the following additional fill operations:

FillLine and FillMultiLine.
Draws the entered shape using a line drawing primitive of the basic graphics system.
Draws the entered TextShape using the character generator of the basic graphics system.
FillPie, FillArc, FillRect, and FillEllipse.
Draws the entered shape using corresponding drawing primitives of the basic graphics system.

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