[ prev | next | top ]

6. Decorating Objects

6.1. Dashed Objects

We’ve already seen that the modifier dashed can change the line style of an object from solid to dashed. GNU gpic permits you to dot or dash ellipses, circles, and arcs (and splines in TeX mode only); some versions of DWB may only permit dashing of lines and boxes. It’s possible to change the dash interval by specifying a number after the modifier.

Image grohtml-290718.png

Figure 6-1: Dashed objects

6.2. Dotted Objects

Another available qualifier is dotted. GNU gpic permits you to dot or dash ellipses, circles, and arcs (and splines in TeX mode only); some versions of DWB may only permit dashing of lines and boxes. It too can be suffixed with a number to specify the interval between dots:

Image grohtml-290719.png

Figure 6-2: Dotted objects

6.3. Rounding Box Corners

It is also possible, in GNU gpic only, to modify a box so it has rounded corners:

Image grohtml-290720.png

Figure 6-3: box rad with increasing radius values

Radius values higher than half the minimum box dimension are silently truncated to that value.

6.4. Arrowheads

Lines and arcs can be decorated as well. Any line or arc (and any spline as well) can be decorated with arrowheads by adding one or more as modifiers:

Image grohtml-290721.png

Figure 6-4: Double-headed line made with line <- ->

In fact, the arrow command is just shorthand for line ->. And there is a double-head modifier <->, so the figure above could have been made with line <->.

Arrowheads have a width attribute, the distance across the rear; and a height attribute, the length of the arrowhead along the shaft.

Arrowhead style is controlled by the style variable arrowhead. The DWB and GNU versions interpret it differently. DWB defaults to open arrowheads and an arrowhead value of 2; the Kernighan paper says a value of 7 will make solid arrowheads. GNU gpic defaults to solid arrowheads and an arrowhead value of 1; a value of 0 will produce open arrowheads.

6.5. Line Thickness

It’s also possible to change the line thickness of an object (this is a GNU extension, DWB pic doesn’t support it). The default thickness of the lines used to draw objects is controlled by the linethick variable. This gives the thickness of lines in points. A negative value means use the default thickness: in TeX output mode, this means use a thickness of 8 milliinches; in TeX output mode with the -c option, this means use the line thickness specified by .ps lines; in troff output mode, this means use a thickness proportional to the pointsize. A zero value means draw the thinnest possible line supported by the output device. Initially it has a value of -1. There is also a thickness attribute (which can be abbreviated to thick). For example, circle thickness 1.5 would draw a circle using a line with a thickness of 1.5 points. The thickness of lines is not affected by the value of the scale variable, nor by any width or height given in the .PS line.

6.6. Invisible Objects

The modifier invis[ible] makes an object entirely invisible. This used to be useful for positioning text in an invisible object that is properly joined to neighboring ones. Newer DWB versions and GNU pic treat stand-alone text in exactly this way.

6.7. Filled Objects

It is possible to fill boxes, circles, and ellipses. The modifier fill[ed] accomplishes this. You can suffix it with a fill value; the default is given by the stule variable fillval.

DWB pic and gpic have opposite conventions for fill values and different defaults. DWB fillval defaults to 0.3 and smaller values are darker; GNU fillval uses 0 for white and 1 for black.

Image grohtml-290722.png

Figure 6-5: circle fill; move; circle fill 0.4; move; circle fill 0.9;

GNU gpic makes some additional guarantees. A fill value greater than 1 can also be used: this means fill with the shade of gray that is currently being used for text and lines. Normally this will be black, but output devices may provide a mechanism for changing this. The invisible attribute does not affect the filling of objects. Any text associated with a filled object will be added after the object has been filled, so that the text will not be obscured by the filling.

The closed-object modifier solid is equivalent to fill with the darkest fill value (DWB pic had this capability but mentioned it only in a reference section).

6.8. Colored Objects

As a GNU extension, three additional modifiers are available to specify colored objects. outline sets the color of the outline, shaded the fill color, and color sets both. All three keywords expect a suffix specifying the color. Example:

Image grohtml-290723.png

Figure 6-6: box color "yellow"; arrow color "cyan"; circle shaded "green" outline "black";

Alternative spellings are colour, colored, coloured, and outlined.

Currently, color support is not available in TeX mode. Predefined color names for groff(1) are in the device macro files, for example ps.tmac; additional colors can be defined with the .defcolor request (see the manual page of GNU troff(1) for more details).

[ prev | next | top ]