Unit – II
Line Attributes
Basic attributes of a straight line segment are its type, its width, and its
colour. In some graphics packages, lines can also be displayed using selected
pen or brush options
* Line Type
* Line Width
* Pen and Brush Options
* Line Colour
Line type
Possible selection of line type attribute includes solid lines, dashed lines
and dotted lines. To set line type attributes in a PHIGS application program, a
user invokes the function
setLinetype (lt)
Where parameter lt is assigned a positive integer value of 1, 2, 3 or 4 to
generate lines that are solid, dashed, dash dotted respectively. Other values for
line type parameter it could be used to display variations in dot-dash patterns.
Line width
Implementation of line width option depends on the capabilities of the output device to set
the line width attributes.
setLinewidthScaleFactor (lw)
Line width parameter lw is assigned a positive number to indicate the relative width of
line to be displayed. A value of 1 specifies a standard width line. A user could set lw to a value
of 0.5 to plot a line whose width is half that of the standard line. Values greater than 1 produce
lines thicker than the standard.
Line Cap
We can adjust the shape of the line ends to give them a better appearance by adding line
caps.
There are three types of line cap. They are
* Butt cap
* Round cap
* Projecting square cap
Butt cap obtained by adjusting the end positions of the component parallel lines so that the
thick line is displayed with square ends that are perpendicular to the line path.
Round cap obtained by adding a filled semicircle to each butt cap. The circular arcs are
centered on the line endpoints and have a diameter equal to the line thickness.
Projecting square cap extend the line and add butt caps that are positioned one-half of the
line width beyond the specified endpoints.
Three possible methods for smoothly joining two line segments
* Mitter Join
* Round Join
* Bevel Join
A miter join accomplished by extending the outer boundaries of each of the two lines
until they meet.
A round join is produced by capping the connection between the two segments with a
circular boundary whose diameter is equal to the width.
A bevel join is generated by displaying the line segment with but caps and filling in
triangular gap where the segments meet.
Pen and Brush Options
With some packages, lines can be displayed with pen or brush selections.
Options in this category include shape, size, and pattern. Some possible pen
or brush shapes are given in Figure
Line colour
A poly line routine displays a line in the current color by setting this color
value in the frame buffer at pixel locations along the line path using the set
pixel procedure.
We set the line colour value in PHlGS with the function
setPolylineColourIndex (Ic)
Nonnegative integer values, corresponding to allowed color choices, are
assigned to the line colour parameter lc
Character Attributes
The appearance of displayed character is controlled by attributes such as font, size,
color and orientation. Attributes can be set both for entire character strings (text) and for
individual characters defined as marker symbols
Text Attributes
The choice of font or type face is set of characters with a particular design style as
courier, Helvetica, times roman, and various symbol groups.
The characters in a selected font also be displayed with styles. (solid, dotted, double)
in bold face in italics, and in outline or shadow styles.
A particular font and associated stvle is selected in a PHIGS program by setting an
integer code for the text font parameter tf in the function
setTextFont (tf)
Control of text color (or intensity) is managed from an application program with
setTextColourIndex (tc)
Where text color parameter tc specifies an allowable color code.
Text size can be adjusted without changing the width to height ratio of characters with
setCharacterHeight (ch)
Parameter ch is assigned a real value greater than 0 to set the coordinate height of
capital letters
The width only of text can be set with function.
setCharacterExpansionFactor (cw)
Where the character width parameter cw is set to a positive real value that scales
the body width of character
Spacing between characters is controlled separately with
setCharacterSpacing (cs)
Where the character-spacing parameter cs can he assigned any real value
The orientation for a displayed character string is set according to the
direction of the character up vector
setCharacterUpVector (upvect)
Parameter upvect in this function is assigned two values that specify the x
and y vector components. For example, with upvect = (1, 1), the direction of the
up vector is 45o and text would be displayed as shown in Figure.
To arrange character strings vertically or horizontally
setTextPath (tp)
can be assigned the value: right, left, up, or down
Another handy attribute for character strings is alignment. This attribute specifies how
text is to be positioned with respect to the $tart coordinates. Alignment attributes are set with
setTextAlignment (h,v)
where parameters h and v control horizontal and vertical alignment. Horizontal
alignment is set by assigning h a value of left, center, or right. Vertical alignment is set by
assigning v a value of top, cap, half, base or bottom.
A precision specification for text display is given with
setTextPrecision (tpr)
tpr is assigned one of values string, char or stroke.
Marker Attributes
A marker symbol is a single character that can he displayed in different colors and in
different sizes. Marker attributes are implemented by procedures that load the chosen
character into the raster at the defined positions with the specified color and size. We select a
particular character to be the marker symbol with
setMarkerType (mt)
where marker type parameter mt is set to an integer code. Typical codes for marker type
are the integers 1 through 5, specifying, respectively, a dot (.) a vertical cross (+), an asterisk
(*), a circle (o), and a diagonal cross (X).
We set the marker size with
setMarkerSizeScaleFactor (ms)
with parameter marker size ms assigned a positive number. This scaling
parameter is applied to the nominal size for the particular marker symbol
chosen. Values greater than 1 produce character enlargement; values less than 1
reduce the marker size.
Marker color is specified with
setPolyMarkerColourIndex (mc)
A selected colour code parameter mc is stored in the current attribute list
and used to display subsequently specified marker primitives