You are on page 1of 30

1 30/9/2008

Attribute of Output
Primitives
Lecture 2
2 30/9/2008

Attribute of Output Primitives


Definition
Line Attribute
Curve Attribute
COLOR AND GRAY SCALE LEVEL
AREA FILLED ATTRIBUTE
Text and Characters

Lecture 2
3 30/9/2008

Definition
Parameter that affects the way a primitive will be
displayed

Line Attribute
. Type
. Width
. Color
. Pen & Brush
Lecture 2
4 30/9/2008

Lecture 2
5 30/9/2008

Line Attribute
Type
. Solid
. Dotted – very short dash with spacing equal to
or greater than dash itself
. Dashed – displayed by generating an interdash
spacing

Lecture 2
6 30/9/2008

Lecture 2
7 30/9/2008

Lecture 2
8 30/9/2008

Width
. Specify in pixels and proportion of a standard line width.
. Thicker line can be produced by.
. Adding extra pixel vertically when |m| < 1
. Adding extra pixel horizontally when |m| > 1

Lecture 2
9 30/9/2008

Line Attribute
Width

Lecture 2
10 30/9/2008

Attributes of Output Primitives

Lecture 2
11 30/9/2008

Lecture 2
12 30/9/2008

Attributes of Output Primitives

Lecture 2
13 30/9/2008

Lecture 2
14 30/9/2008

Lecture 2
15 30/9/2008

Line Attribute
Pen and Brush
. The selected “pen” or “brush” determine the way a line will be drawn.
. Pens and brushes have size, shape, color and pattern attribute.
. Pixel mask is applied in both of them.

Lecture 2
16 30/9/2008

Curve Attribute
Similar to line : type + width
Thicker curves can be produced by:
1. Plotting additional pixel
2. Filling the space between two concentric circles.
3. Using thicker pen or brush

Lecture 2
17 30/9/2008

Curve Attribute

Lecture 2
18 30/9/2008

COLOR AND GRAY SCALE LEVEL


Various color and intensity-level options can be made
available to a user, depending on the capabilities and design
objectives of a particular system
•In a color raster system, the number of color choices available
depends on the amount of storage provided per pixel in the
frame buffer
•Color-information can be stored in the frame buffer in two
ways:
• We can store color codes directly in the frame buffer
• We can put the color codes in a separate table and use pixel
values as an index into this table
Lecture 2
19 30/9/2008

2 A minimum number of colors can be rovided in this


scheme with 3 bits of storage per pixel.
Color tables(Color Lookup Tables) are an alternate means
for providing extended color capabilities to a user without
requiring large frame buffers
3 bits - 8 choice of color
6 bits – 64 choice of color
8 bits – 256 choice of color

Lecture 2
20 30/9/2008

COLOR Lookup Table

Lecture 2
21 30/9/2008

COLOR Lookup Table

Lecture 2
22 30/9/2008

• A user can set color-table entries in a PHIGS


applications program with the function
setColourRepresentation (ws, ci, colorptr)
• Parameter ws identifies the workstation output device;
parameter ci specifies the color index, which is the
color-table position number (0 to 255) and parameter
colorptr points to a trio of RGB color values (r, g, b)
each specified in the range from 0 to 1

Lecture 2
23 30/9/2008

GRAY SCALE LEVEL


With monitors that have no color capability, color functions can
be used in an application program to set the shades of gray, or
grayscale, for displayed primitives. Numeric values over the range
from 0 to 1 can be used to specify grayscale levels, which are then
converted to appropriate binary codes for storage in the raster.

Intensity = 0.5[min(r,g,b)+max(r,g,b)]

Lecture 2
24 30/9/2008

AREA-FILL ATTRIBUTES
Options for filling a defined region include a choice
between a solid color or a pattern fill and choices for
particular colors and patterns
Fill Styles
•Areas are displayed with three basic fill styles: hollow
with a color border, filled with a solid color, or filled
with a specified pattern or design. A basic fill style is
selected in a PHIGS program with the function
•setInteriorStyle(fs)

Lecture 2
25 30/9/2008

• Values for the fill-style parameter fs include hollow, solid,


and pattern. Another value for fill style is hatch, which is
used to fill an area with selected hatching patterns-parallel
lines or crossed lines

Lecture 2
26 30/9/2008

• The color for a solid interior or for a hollow area outline is


chosen with where fill color parameter fc is set to the
desired color code
• setInteriorColourIndex(fc)

Lecture 2
27 30/9/2008

Pattern Fill

We select fill patterns with


setInteriorStyleIndex (pi)
where pattern index parameter pi specifies a table position
For example, the following set of statements would fill the
area defined in the fillArea command with the second
pattern type stored in the pattern table:
SetInteriorStyle( pattern)
SetInteriorStyleIndex(2);
Fill area (n, points)

setPatternRepresentation(ws,pi,nx,ny,cp)
Lecture 2
29 30/9/2008

AREA FILLED ATTRIBUTE


Soft-Fill
The boundary fill that appiled to repaint areas so that
the fill color is combined with backgrouding colours are
reffered to as soft fill or tint fill algorithms.
P = tF + (1-t)B
If t < 0.5 , background color contributes more to the
interior color of the region than does the fill color.

Lecture 2
30 30/9/2008

• The value of parameter t using RGB colour as t=


Pk-Bk/Fk-Bk.
• Two background B1 and B2 are mixed with foreground
color F the resulting pixel color P is
P=t0F+t1B1+(1-t0-t1)B2.

Lecture 2

You might also like