840 likes | 2.22k Views
Attributes of Output Primitives. Definition: Parameter that affects the way a primitive will be displayed. Line Attributes Curve Attributes Color and Gray Scale Levels Area Filled Attributes Text and Characters Attributes Bundled Attributes. Attributes of Output Primitives.
E N D
Attributes of Output Primitives • Definition: • Parameter that affects the way a primitive will be displayed. • Line Attributes • Curve Attributes • Color and Gray Scale Levels • Area Filled Attributes • Text and Characters Attributes • Bundled Attributes
Attributes of Output Primitives • Line Attributes : • Line Type • Line Width • Line Color • Pen & Brush Options • Line Type • setLinetype(lt) • lt 4 values 1-4
Line Attribute • Line Type • 1. Solid • 2. Dotted – very short dash with spacing equal to • or greater than dash itself • 3. Dashed – displayed by generating an interdash spacing • 4. Dash dotted -.-.-.-.-.-. • `Pixel count for the span and interspan length is specified • by the mask . Ex. 111100011110001111Note :
Line Attribute Line 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 Issues: Line have different thickness on the slope Problem with End of the line Joining the two lines (polygon)
Line Attribute Line Width
Line Attributes Line color: setPolylineColorIndex(lc)
Line Attribute Pen and Brush Options 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.
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
Curve Attribute Curve Type: Pixel masks are also used in curve algorithms to generate dashes and dotted patterns. For example, the mask 111000 produces the dashed circle as in figure.
Curve Attribute – Curve width • Method 1: • If the magnitude of the curve slope is less than 1, plot vertical spans; If the slope magnitude is greater than 1, plot horizontal spans.
Curve Attribute Width • Method 2: • Fill in the area between two parallel curve paths, whose separation distance is equal to the desired width.
Color and Gray Scale Level Color • Colors are represented by colors codes which are positive integers. • Color information is stored in frame buffer or in separate table and use pixel values as index to the color table. • Two ways to store color information : 1. Direct 2. Indirect
COLOR Direct
COLOR Indirect
Color User can set color table entries in a program as setColorRepresentation(ws,ci,colorptr) ws-> workstation output device ci-> color index(0 to 255) colorptr-> points to RGB values 0 to 1
Gray Scale Level . Apply for monitor that have no color Shades of grey (white->light grey->dark grey->black) . Color code mapped onto grayscale codes 2 bits can give 4 level of grayscale 8 bits per pixel will allow 256 combination . Dividing the actual code with 256 will give range of 0 and 1 E.g. Ex Color code in color display is 118 To map to nearest grayscale then 118/256 = 0.45 light gray
Area Filled Attribute • Tiling: • The process of filling an area with a rectangular pattern is called tiling and rectangular fill patterns are sometimes referred to as tiling patterns.
Area Filled Attribute 3. Soft fill: • Modified boundary-fill and flood-fill procedures that are applied to repaint areas so that the fill color is combined with the background colors are referred to as soft-fill or tint algorithms. • The linear soft-fill algorithm repaints an area that was originally painted by merging a foreground color F with a single background color B, where F!=B.
Area Filled Attribute • Soft-fill • P = tF + (1-t)B where 0 < t < 1 • If t < 0.5 , background color contributes more to the interior color of the region than does the fill color.
5. Character Attributes • Divided into two • Text attributes • Marker attributes • Text and Characters • Very important output primitive • Many pictures require text
Text attributes • Attributes are set for the entire character or string. • Includes • Font type • Font size • Underline style etc • Font type is set using the function: setTextFont(tf)
Text attributes To set text color: setTextColorIndex(tc) tc available color code Character height is defined as the distance between the baseline and the capline of characters.
Text attributes Text size can be adjusted without changing the width-to-height ratio of characters with setCharacterHeight(ch) cha real value greater than 0 to set the coordinate height of capital letters
Text attributes The width only of text can be set wlth the function setCharacterExpansionFactor(cw) chcharacter-width parameter
Text attributes Spacing between characters is controlled separately with setCharacterSpacing(cs) csCharacter spacing parameter
Text attributes The orientation for a displayed character string is set as setCharacterUpVector(upvect)
Text attributes To arrange character strings vertically or horizontally: setTextPath(tp) tptext-path parameter tp right, left, up, or down
Text attributes Alignment attributes arc set with setTextAlignment(h,v) h,vcontrol horizontal and vertical alignment,
Text attributes A precision specificationf or text display is given with setTextPrecision(tpr) tprvalues: string, char, or stroke. String—lowest quality Storke—high quality text
Marker Attributes A marker symbol is a single character that can he displayed in different colors and in different sizes. A particular character is selected to be the marker symbol with setMarkerType(mt) mt marker type parameter ranges from 1 to 5. 1-dot(.), 2-a vertical cross(+), 3-an asterisk(*), 4-a circle(O), 5- a diagonal cross.
Marker Attributes To set marker size setMarkerSizeScaleFactor(ms) msmarker size parameter(positive value) To set marker color setPolymarkerColorIndex(mc)
Bundled Attributes • When each function reference a single attribute that specify exactly how primitive to be displayed ; then its called • individual (unbundled attribute). • Bundledattributes is where a set of attributes value can be chosen by specifying the appropriate index table. • The table for each primitive that defines group of attribute values is called bundled table. • . Attribute that can be bundled are: • Bundled Line Attribute • Bundled Area-Fill Attribute • Bundled Text Attribute • Bundled Marker Attribute
Bundled Attributes • Bundled Line Attributes: • The line attributes on a specified workstation is set using the function setPolylineRepresentation(ws,li,lt,lw,lc) • where, ws—workstation identifier, li—Line Index Parameter, lt—line type, lw—line width, lc—line color • E.g. setPolylineRepresentation(1,3,2, 0.5,1) • - draws a blue colored line with half width.
Bundled Attributes • A particular attribute is then selected from the table with the function setPolylineIndex(li) • where li is the line index
Bundled Attributes • Bundled Area fill attributes: • Table entries for bundled area-fill attributes are set with setInteriorRepresentation(ws,fi,fs,pi,fc) • where, ws—workstation identifier, fi—fill index on workstation, fs—fill style, pi—pattern index, fc—fill color • A particular attribute is then selected from the table with the function setInteriorIndex(fi) • where fi is the fill index
Bundled Attributes • Bundled Text AttributesTable entries for bundled text attributes are set with setTextRepresentation(ws,ti,tf,tp,te,ts,tc) • where, ws—workstation identifier, ti—text index, tf—text font, tp—text precision, te—text expansion factor, ts—text size,tc—text color - A particular attribute is then selected from the table with the function setTextIndex(ti)where ti is the text index
Bundled Attributes • Bundled Marker Attributes-Table entries for bundled text attributes are set with setMarkerRepresentation(ws,mi,mt,ms,mc) • where, ws—workstation identifier, mi—marker index, mt—marker type, ms—marker scale factor, mc—marker color • A particular attribute is then selected from the table with the function setPolymarkerIndex(mi)