Home | | Graphics and Multimedia | Attributes: Line, Curve, Area Fill, Text

Attributes: Line, Curve, Area Fill, Text - | Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail |

Chapter: Graphics and Multimedia - Output Primitives

Attributes: Line, Curve, Area Fill, Text

Basic attributes of a straight line segment are its type, its width, and its color. In some graphics packages, lines can also be displayed using selected pen or brush options.





Basic attributes of a straight line segment are its type, its width, and its color. In some graphics packages, lines can also be displayed using selected pen or brush options.


Line Type

line-type attribute -          solid lines, dashed lines, and dotted lines.

We modify a line drawing algorithm to generate such lines by setting the length and spacing of displayed solid sections along the line path.


A dashed line could be displayed by generating an interdash spacing that is equalto the length of the solid sections. Both the length of the dashes and the interdashspacing are often specified as user options. A dotted line can be displayed bygenerating very short dashes with the spacing equal to or greater than the dash size. Similar methods are used to produce other line-type variations.


To set line type attributes in a PHICS application program, a user invokes the function


setLinetype (It)


where parameter I t is assigned a positive integer value of 1,2,3, or 4 to generate lines that are, respectively, solid, dashed, dotted, or dash-dotted.


Line Width


We set the line-width attribute with the command: Line-width parameter lr. is assigned a positive number to indicate the relative width of the line to be displayed. A value of 1 specifies a standard-width line. On.


For lines with slope magnitude greater than 1, we can plot thick lines withhorizontal spans, alternately picking up pixels to the right and left of the linepath.


Problem with implementing width options using horizontal or vertical pixel spans is that the method produces lines whose ends are horizontal or vertical regardless of the slope of the line. This effect is more noticeable with very thick lines. We can adjust the shape of the line ends to give them a better appearance by adding line caps


One kind of line cap is the 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. If the specified line has slope m, the square end of the thick line has slope - l / m .


Another line cap is the round cap obtained by adding a filled semicircle to eachbutt cap. The circular arcs are centered on the line endpoints and have a diameterequal to the line thickness.


A third type of line cap is the projecting square cap.Here, we simply extend the line and add butt caps that are positioned one-half ofthe line width beyond the specified endpoints.

We can generate thick polylines that are smoothly joined at the cost of additional processing at the segment endpoints.


A miter join is accomplished by extending the outer boundaries of each of the two linesuntil 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 linewidth.

And a bevel join is generated by displaying the line segments with butt caps and filling in the triangular gap where the segments meet.

Pen and Brush Options


lines can be displayed with pen or brush selections. Options in this category include shape, size, and pattern.


These shapes can be stored in a pixel mask that identifies the array of pixel positions that are to be set along the line path. Lines generated with pen (or brush) shapes canbe displayed in various widths by changing the size of the mask.


Line Color


When a system provides color (or intensity) options, a parameter giving the current


color index is included in the list of system-attribute values. A polyline routinedisplays a line in the current color by setting this color value in the framebuffer at pixel locations along the line path using the setpixel procedure.


The number of color choices depends on the number of bits available per pixel in theframe buffer.We set the line color value in PHlCS with the function

Set PolylineColourIndex (le)



Parameters for curve attributes are the same as those for line segments. We can display curves with varying colors, widths, dotdash patterns, and available pen or brush options.



is generated with a linedrawing routine as a closed polyline



The appearance of displayed characters is controlled by attributes such as font, size, color, and orientation. Attributes can be set for entire character strings (text) and for individual characters defined as marker symbols.



There are a great many text options that can be made available to graphics programmers.

First of all, there is the choice of font (or typeface), which is a set of characters with a particular design style such as New York, Courier, Helvetica, London, 'Times Roman, and various special symbol groups.



Displayed primitives generated by the raster algorithms have a jagged, or stairstep, appearance because the sampling process digitizes coordinatepoints on an object to discrete integer pixel positions. This distortion of information due to low-frequency sampling (undersampling) is called aliasing.


We can improve the appearance of displayed raster lines by applying antialiasingmethods that compensate for the undersampling process.To avoid losing information from such periodic objects, we need to set the sampling frequency to at least twice that of the highest frequency occurring in the object, referredto as the Nyquist sampling frequency (or Nyquist sampling rate) fs:

Another way to state this is that the sampling interval should be no larger than one-half the cycle interval (called the Nyquist sampling interval). For x-interval sampling, the Nyquist sampling interval Ax, is

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail

Copyright © 2018-2021 BrainKart.com; All Rights Reserved. (BS) Developed by Therithal info, Chennai.