logging in or signing up Graphics ch04 1 flsteen Download Post to : URL : Related Presentations : Let's Connect Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Copy embed code: Embed: Flash iPad Dynamic Copy Does not support media & animations Automatically changes to Flash or non-Flash embed WordPress Embed Customize Embed URL: Copy Thumbnail: Copy The presentation is successfully added In Your Favorites. Views: 978 Category: Product Traini.. License: All Rights Reserved Like it (0) Dislike it (0) Added: December 29, 2009 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Slide 1: Dr. ISMAEL JANNOUD Graphics Outlines : Dr. ISMAEL JANNOUD Graphics Outlines 4-1 OpenGL State Variables 4-2 Color and Gray Scale 4-3 OpenGL Color Functions 4-4 Point Attributes 4-5 Line Attributes 4-6 Curve Attributes 4-7 OpenGL Point-Attribute Functions 4-8 OpenGL Line-Attribute Functions 4-9 Fill-Area Attributes 4-10 General Scan-Line Polygon-Fill Algorithm 4-11 Scan-Line Fill of Convex Polygons 4-12 Scan-Line Fill for Regions with Curved Boundaries 4-13 Fill Methods for Areas with Irregular Boundaries 4-14 OpenGL Fill-Area Attribute Functions 4-15 Character Attributes 4-16 OpenGL Character-Attribute Functions 4-17 Antialiasing 4-18 OpenGL Antialiasing Functions 4-19 OpenGL Query Functions 4-20 OpenGL Attribute Groups 4-21 Summary Introduction of Attributes : Dr. ISMAEL JANNOUD Graphics Introduction of Attributes What is the attribute parameter means? a parameter that affects the way a primitive is to be displayed is referred to as an. Attributes Types: - General: Color, Size determine the fundamental characteristics of a primitive. - Special: visibility, detectability specify how the primitive is to be displayed under special conditions. Here we will discuss the general attributes for lines such (Dot, Dash,…) and for filled areas such (with one color, or with a multicolor pattern) State system or State machine: a list of current attributes State variables or State parameters: attributes output primitives and current frame buffer COLOR AND GRAY SCALE : Dr. ISMAEL JANNOUD Graphics COLOR AND GRAY SCALE RGB Color Components Color Tables Gray Scale Other Color Parameters COLOR AND GRAY SCALE Cnt. : Dr. ISMAEL JANNOUD Graphics COLOR AND GRAY SCALE Cnt. RGB Color Components 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 stored in frame buffer by two ways: RGB color codes may stored directly, or color codes may fit into table and use the pixel locations to store index values referencing the color-table entries. COLOR AND GRAY SCALE Cnt. : Dr. ISMAEL JANNOUD Graphics Color Tables color lookup table = color map = video lookup table COLOR AND GRAY SCALE Cnt. COLOR AND GRAY SCALE Cnt. : Dr. ISMAEL JANNOUD Graphics COLOR AND GRAY SCALE Cnt. Gray Scale When an RGB color setting specifies an equal amount of red, green, and blue, the result is some shade of gray. Values close to 0 for the color components produce dark gray, and higher values near 1.0 produce light gray. Other Color Parameters other three-component color representations are useful in computer-graphics applications. For example, color output on printers is described with cyan, magenta, and yellow color components, and color interfaces sometimes use parameters such as lightness and darkness to choose a color. RGB MODEL : Dr. ISMAEL JANNOUD Graphics RGB MODEL POINT ATTRIBUTES : Dr. ISMAEL JANNOUD Graphics POINT ATTRIBUTES Basically, we can set two attributes for points: color and size. In a state system, the displayed color and size of a point is determined by the current values stored in the attribute list. Color components are set with RGB values or an index into a color table. For a raster system, point size is an integer multiple of the pixel size, so that a large point is displayed as a square block of pixels. LINE ATTRIBUTES : Dr. ISMAEL JANNOUD Graphics LINE ATTRIBUTES A straight-line segment can be displayed with three basic attributes: Color Width Style Other effects that may be used for lines: Pen Brush LINE ATTRIBUTES Cnt. : Dr. ISMAEL JANNOUD Graphics LINE ATTRIBUTES Cnt. Line Width Implementation of line-width options depends on the capabilities of the output device. A heavy line could be displayed on a video monitor as adjacent parallel lines, while a pen plotter might require pen changes to draw a thick line. If a line has slope magnitude less than or equal to 1.0, we can modify a line-drawing routine to display thick lines by plotting a vertical span of pixels in each column (x position) along the line. If line slope greater than 1.0 in magnitude, we can display thick lines using horizontal spans, alternately picking up pixels to the right and left of the line path. |m| > 1.0 |m| < 1.0 LINE ATTRIBUTES Cnt. : Dr. ISMAEL JANNOUD Graphics LINE ATTRIBUTES Cnt. Line-Width depends on its slop! A 45◦ line will be displayed thinner by a factor of 1/√2 compared to a horizontal or vertical line plotted with the same-length pixel spans. Adjusting the shape of the line ends to give them a better appearance by adding line caps as: (a) Butt cap (b) Round cap (c) Projection square cap Thick Line Segments Connected with a different patterns: (a) Miter join (b) Round join or, (c) Bevel join LINE ATTRIBUTES Cnt. : Dr. ISMAEL JANNOUD Graphics LINE ATTRIBUTES Cnt. Line Style Possible selection for the line-style attribute include: solid lines, dash lines, and dotted lines One way to plotting dash spacing is to use what called: Pixel mask: Which is a pattern of binary digits indicating which positions to plot along the line path. Example: Linear mask of 11111000 could be used to display a dashed line with a dash length of five pixels and an inter-dash spacing of three pixels Unequal length dashes displayed with the same number of pixels. Slide 14: Dr. ISMAEL JANNOUD Graphics Pen and Brush options LINE ATTRIBUTES Cnt. A pixel mask (a) for a rectangular pen, and the associated array of pixels (b) displayed by centering the mask over a specified pixel position. Generating a line with the pen shape of above figure CURVE ATTRIBUTES : Dr. ISMAEL JANNOUD Graphics CURVE ATTRIBUTES Parameters for curve attributes are the same as those for straight-line segments. We can display curves with varying colors, widths, dot-dash patterns, and available pen or brush options Methods for adapting curve-drawing algorithms to accommodate attribute selections are similar to those for line drawing. Methods for curve-drawing: Curve Width using the method of horizontal or vertical pixel spans. By using fill area between the two parallel curve paths. Curve Style pixel masks methods Pen (or brush) methods Curve Width Methods Cnt. : Dr. ISMAEL JANNOUD Graphics Curve Width Methods Cnt. Raster curves of various widths can be displayed using the method of horizontal or vertical pixel spans: Where the magnitude of the curve slope is less than or equal to 1.0, we plot vertical spans; where the slope magnitude is greater than 1.0, we plot horizontal spans. A circular arc of width 4 plotted with either vertical or horizontal pixel spans, depending on the slope. Curve Width Methods Cnt. : Dr. ISMAEL JANNOUD Graphics Curve Width Methods Cnt. displaying thick curves is to fill in the area between two parallel curve paths, whose separation distance is equal to the desired width. A circular arc of width 4 and radius 16 displayed by filling the region between two concentric arcs. Curve Style Methods : Dr. ISMAEL JANNOUD Graphics Curve Style Methods pixel masks discussed for implementing line-style options could also be used in raster curve algorithms to generate dashed or dotted patterns. For example, the mask 11100 produces the dashed circle shown in the Figure A dashed circular arc displayed with a dash span of 3 pixels and an inter-dash spacing of 2 pixels. Curve Style Methods Cnt. : Dr. ISMAEL JANNOUD Graphics Curve Style Methods Cnt. Pen (or brush) displays of curves are generated using the same techniques discussed for straight-line segments. We replicate a pen shape along the line path, as illustrated in the Figure bellow for a circular arc in the first quadrant. Here, the center of the rectangular pen is moved to successive curve positions to produce the curve shape shown. Curves A circular arc displayed with a rectangular pen. Curve Patterns : Dr. ISMAEL JANNOUD Graphics Curve Patterns Different shapes and patterns may be used for curve drawing implementation, shown in the figure bellow. Curved lines drawn with a paint program using various shapes and patterns. From left to right, the brush shapes are square, round, diagonal line, dot pattern, and faded airbrush. A daruma doll, a symbol of good fortune in Japan, drawn by computer artist Koichi Kozaki using a paintbrush system. Daruma dolls actually come without eyes. One eye is painted in when a wish is made, and the other is painted in when the wish comes true. (Courtesy of Wacom Technology, Corp.) FILL-AREA ATTRIBUTES : Dr. ISMAEL JANNOUD Graphics FILL-AREA ATTRIBUTES Introduction: Most graphics packages limit fill areas to polygons, because they are described with linear equations. A further restriction requires fill areas to be convex polygons, so that scan lines do not intersect more than two boundary edges. However, in general, we can fill any specified regions, including circles, ellipses, and other objects with curved boundaries. Two Methods For Fill-Area One procedure first determines the overlap intervals for scan lines that cross the area. Then, pixel positions along these overlap intervals are set to the fill color. Another method for area filling is to start from a given interior position and “paint” outward, pixel by-pixel, from this point until we encounter specified boundary conditions. FILL-AREA ATTRIBUTES Cnt. : Dr. ISMAEL JANNOUD Graphics FILL-AREA ATTRIBUTES Cnt. Fill Styles: Hollow: Only the boundary is displayed Solid: of desired color Patterned: Different colors and shapes Hollow Solid Patterned FILL-AREA ATTRIBUTES Cnt : Dr. ISMAEL JANNOUD Graphics FILL-AREA ATTRIBUTES Cnt Fill patterns can be defined in: rectangular color arrays that list different colors for different positions in the array. Or, In a fill pattern could be specified as a bit array that indicates which relative positions are to be displayed in a single selected color. Other fill patterns: Using array masks Using Hatch patterns Color-Blended Fill Regions : Dr. ISMAEL JANNOUD Graphics Color-Blended Fill Regions It is also possible to combine a fill pattern with background colors in various ways. A pattern could be combined with background colors using a transparency factor that determines how much of the background should be mixed with the object color. Or we could use simple logical or replace operations. Some fill methods using blended colors have been referred to as soft-fill algorithm or tint-fill algorithm. Color-Blended Fill Regions Cnt. : Dr. ISMAEL JANNOUD Graphics Color-Blended Fill Regions Cnt. Combining a fill pattern with a Background pattern using logical operations and, or, and xor (exclusive or), and using simple replacement. You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.