Next: Mapping Functions, Previous: Drawing Functions, Up: Functions
The following are the “attribute functions” in libplot
. When
invoked on a Plotter, these functions set its drawing attributes, or
save them or restore them. Path-related attributes include graphics
cursor position, pen color, fill color, fill rule, line thickness, line
style, cap style, join style, miter limit, and transformation matrix.
Text-related attributes include pen color, font name, font size, text
angle, and transformation matrix.
Setting any path-related drawing attribute automatically terminates and
draws the path under construction (if any), as if the
endpath
operation had been invoked. The `orientation' attribute
(clockwise/counterclockwise), which affects circles, ellipses, and
boxes, is an exception to this. The exception allows a compound path to
include circles, ellipses, and boxes with different orientations.
In the current C binding, each of these functions takes a pointer to
a plPlotter
as its first argument. Also in the current C binding, the name of each function begins with "pl_" and ends with "_r". ("_r" stands for `revised' or `reentrant'.) For information
on older C bindings, see Older C APIs. In the C++
binding, these are member functions of the Plotter
class and its
subclasses, and the prefix and suffix are not used.
PNG, PNM, GIF, PCL, and HP-GL Plotters support a fourth cap mode, "triangular". (For all but PCL and HP-GL Plotters, the support is currently only partial.) Plotters other than these treat "triangular" as equivalent to "round".
This function has no effect on ReGIS or Tektronix Plotters. Also, it
has no effect on HP-GL Plotters if the parameter HPGL_VERSION
is
set to a value less than "2" (the default), or on CGM Plotters if
the parameter CGM_MAX_VERSION
is set to a value less than "3". See Plotter Parameters.
Note that the physical fill color depends also on the fill level, which
is specified by calling filltype.
CGM, Fig, and ReGIS Plotters do not support the "nonzero-winding" rule,
because the CGM, Fig, and ReGIS vector graphics formats do not
support it. Also, HP-GL Plotters do not support "nonzero-winding"
if HPGL_VERSION
is set to a value less than "2" (the default).
See Plotter Parameters.
The LaserJet III, which was Hewlett–Packard's first PCL 5 printer,
did not support the nonzero-winding fill rule. However, all later
PCL 5 printers from Hewlett–Packard support it.
As a convenience to the user, level may be set to any value in the range 0x0000...0xffff, i.e., 0...65535. Any nonzero value will produce filling. If level=0xffff, the fill color will be white. Values in the range 0x0001...0xffff are interpreted as specifying a desaturation, or gray level. For example, 0x8000 specifies 50% filling (the fill color will be half-way between the color specified by calling fillcolor or fillcolorname, and white).
To draw the region bounded by a path in an edgeless way, you would call filltype to turn on the filling of the interior, and pentype to turn off the drawing of the boundary.
Tektronix Plotters do not support filling, and HP-GL Plotters support
filling of arbitrary paths only if the parameter HPGL_VERSION
is
equal to "1.5" or "2" (the default). (If the version is "1"
then only circles and rectangles aligned with the coordinate axes may be
filled.) Opaque filling, including white filling, is supported
only if the parameter HPGL_VERSION
is "2" and the parameter
HPGL_OPAQUE_MODE
is "yes" (the default). See Plotter Parameters.
Examples of typical values for limit are 10.43 (the default, which cuts off miters if the join angle is less than 11 degrees), 2.0 (the same, for 60 degrees), and 1.414 (the same, for 90 degrees). In general, the miter limit is the cosecant of one-half the minimum angle for mitered joins. The minimum meaningful value for limit is 1.0, which converts all mitered joins to beveled joins, irrespective of join angle. Specifying a value less than 1.0 resets the limit to the default.
This function has no effect on X Drawable Plotters or X Plotters, since the X Window System miter limit, which is also
10.43, cannot be altered. It also has no effect on Tektronix, ReGIS, or
Fig Plotters, or on HP-GL Plotters if the parameter HPGL_VERSION
is set to a value less than "2" (the default). See Plotter Parameters. The miter limit used by HP-GL or PCL Plotters is always
rounded to the closest integer, downward.
The default font name depends on the type of Plotter. It is
"Helvetica" for all Plotters except for PCL Plotters, for which it is
"Univers", and PNG, PNM, GIF, HP-GL, ReGIS, Tektronix and Metafile
Plotters, for which it is "HersheySerif". If the argument
font_name is NULL or the empty string, or the font is not
available, the default font name will be used. Which fonts are
available also depends on the type of Plotter; for a list of all
available fonts, see Text Fonts.
A negative value for size sets the size to the default, which
depends on the type of Plotter. Typically, the default font size is
1/50 times the size (i.e., minimum dimension) of the display. The
interpretation of zero font size is also Plotter-dependent (most
Plotters do not draw text strings if the font size is zero).
PNG, PNM, GIF, PCL, and HP-GL Plotters support a fourth join mode, "triangular". Other Plotters treat "triangular" as equivalent to "round".
This function has no effect on ReGIS or Tektronix Plotters. Also, it
has no effect on HP-GL Plotters if the parameter HPGL_VERSION
is
set to a value less than "2" (the default), or on CGM Plotters if
the parameter CGM_MAX_VERSION
is set to a value less than "3". See Plotter Parameters.
The offset argument specifies the `phase' of the dash pattern relative to the start of the path. It is interpreted as the distance into the dash pattern at which the dashing should begin. For example, if offset equals zero then the path will begin with a dash, of length dashes[0] in user space. If offset equals dashes[0] then the path will begin with a gap of length dashes[1], and so forth. offset is allowed to be negative.
Not all Plotters fully support linedash and flinedash. PCL and
HP-GL Plotters cannot dash with a nonzero offset, and in the dash
patterns used by X and X Drawable Plotters, each dash or gap has
a maximum length of 255 pixels. linedash and flinedash have no
effect at all on Tektronix, ReGIS, and Fig Plotters. Also, they
have no effect on HP-GL Plotters for which the parameter
HPGL_VERSION
is less than "2" (the default), or on CGM
Plotters for which the parameter CGM_MAX_VERSION
is less than "3". For information on Plotter parameters, see Plotter Parameters.
Warning: If the transformation from the user coordinate system
to the device coordinate system is anisotropic, each dash pattern should
ideally be drawn on the graphics display with a length that depends on
its direction. But currently, only SVG and Postscript Plotters do this. Other Plotters always draw any specified dash pattern with the
same length, irrespective of its direction. The length that is used is
the minimum length, in the device coordinate system, that can correspond
to the specified dash pattern length in the user coordinate system.
"solid" -------------------------------- "dotted" - - - - - - - - "dotdashed" ---- - ---- - ---- - "shortdashed" ---- ---- ---- ---- "longdashed" ------- ------- ------- "dotdotdashed" ---- - - ---- - - "dotdotdotdashed" ---- - - - ---- - - -
In the preceding patterns, each hyphen stands for one line thickness. This is the case for sufficiently thick lines, at least. So for sufficiently thick lines, the distance over which a dash pattern repeats is scaled proportionately to the line thickness.
The "disconnected" line style is special. A "disconnected" path is rendered as a set of filled circles, each of which has diameter equal to the nominal line thickness. One of these circles is centered on each of the juncture points of the path (i.e., the endpoints of the line segments or arcs from which it is constructed). Circles and ellipses with "disconnected" line style are invisible. Disconnected paths are not filled; this includes circles and ellipses.
All line styles are supported by all Plotters, with the following
exceptions. HP-GL Plotters do not support the "dotdotdotdashed" style
unless the parameter HPGL_VERSION
is set to "2" (the default).
Tektronix Plotters do not support the "dotdotdotdashed" style, and do
not support the "dotdotdashed" style unless the parameter TERM
is
set to "kermit". See Plotter Parameters.
By convention, a zero-thickness line is the thinnest line that can be
drawn. However, the drawing editors idraw
and xfig
treat
zero-thickness lines as invisible. So when producing editable
graphics with a Postscript or Fig Plotter, using a zero line thickness
may not be desirable.
Tektronix and ReGIS Plotters do not support drawing with other than a
default thickness, and HP-GL Plotters do not support doing so if the
parameter HPGL_VERSION
is set to a value less than "2" (the
default; see Plotter Parameters).
Warning: If the transformation from the user coordinate system
to the device coordinate system is anisotropic, each line segment in a
polygonal path should ideally be drawn on the graphics display with a
thickness that depends on its direction. But currently, only SVG and
Postscript Plotters do this. Other Plotters draw all line segments
in a path with the same thickness. The thickness that is used is the
minimum thickness, in the device coordinate system, that can correspond
to the specified line thickness in the user coordinate system.
When a new page of graphics is begun by invoking openpl, the cursor
is initially at the point (0,0) in user space. Most of the drawing
functions reposition the cursor. See Drawing Functions.
orientation will have a visible effect on a circle, ellipse, or box
only if it is dashed, or if it is one of the simple paths in a filled
compound path. Its effects on filling, when the "nonzero-winding" fill
rule is used, are dramatic, since it is the orientation of each simple
path in a compound path that determines which points are `inside' and
which are `outside'.
HP-GL Plotters support drawing with a white pen only if the value of the
parameter HPGL_VERSION
is "2" (the default), and the value of
the parameter HPGL_OPAQUE_MODE
is "yes" (the default).
See Plotter Parameters.
HP-GL Plotters support drawing with a white pen only if the value of the
parameter HPGL_VERSION
is "2" (the default) and the value of
the parameter HPGL_OPAQUE_MODE
is "yes" (the default).
See Plotter Parameters.
To draw the region bounded by a path in an edgeless way, you would call pentype to turn off the drawing of the boundary, and filltype to turn on the filling of the interior.
pentype also affects the drawing of marker symbols and points, i.e., pixels. A value of 0 specifies that they should not be drawn.
Note: In future releases, pentype may also affect the
drawing of text strings (a value of 0 will specify that they
should not be drawn). It already affects text strings that are
rendered using Hershey fonts, since they are drawn using polygonal
paths.
libplot
's drawing attributes, which are set by the attribute
functions documented in this section. So popping off the graphics
context restores the drawing attributes to values they previously had.
A path under construction is regarded as part of the graphics
context. For this reason, calling restorestate automatically calls
endpath to terminate and draw the path under construction, if any. All graphics contexts on the stack are popped off when
closepl
is called, as if restorestate
had been called
repeatedly.
libplot
's drawing attributes, which are set by the attribute
functions documented in this section. A path under construction,
if any, is regarded as part of the graphics context. That is
because paths may be drawn incrementally, one line segment or arc at a
time. The new graphics context created by savestate will contain no
path. When the previous graphics context is returned to by calling
restorestate, the path previously under construction may be
continued.
Warning: Some X Window System displays do not generate or display rotated fonts correctly. In effect, they only support a zero rotation angle.