1 / 36

CGMB214: Introduction to Computer Graphics

CGMB214: Introduction to Computer Graphics. Topic 5 Attributes of Graphics Primitives. Objectives. To understand the characteristic of a primitive. Color and Gray Scale. Color and Gray Scale. Color – A basic attribute for all primitives

mary
Télécharger la présentation

CGMB214: Introduction to Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CGMB214: Introduction to Computer Graphics Topic 5 Attributes of Graphics Primitives

  2. Objectives To understand the characteristic of a primitive

  3. Color and Gray Scale

  4. Color and Gray Scale Color – A basic attribute for all primitives Various color option depend on capabilities and design objectives of a particular system

  5. RGB Color Components • In color raster system (monitor) • Number of color choices available depends on the amount of storage provided per pixel in the frame buffer • Two method of storing color information in the frame buffer • Directly – storing RGB color code directly in the frame buffer • Indirectly – put the color codes into a separate table and use the pixel locations to store index values referencing the color-table entries

  6. RGB Color Components

  7. RGB Color Components • For 24 bit color • Store 8 bits each of red, green and blue perpixel • E.g (255,0,0) is pure red and (255,255,255) is white • Yields 224 = 16 mill colors • For 15 bit colors • 5 bit red+5 bit green+5 bit blue • The video hardware uses the value to drive the R,G and B guns

  8. RGB Color Components • Disadvantage • As more color options are provided, the storage required for the frame buffer also increases • 1024 x 1024 full color (24-bit per pixel) RGB system needs 3MB of storage for the frame buffer • Solution • Storing the color values in a color lookup table (color map)

  9. Color Tables

  10. Color Tables • Values stored in the frame buffer are now used as indices into the color table • Advantages • Reduce the frame-buffer storage requirement to 1MB • Table entries can be change at any time, allowing a user to be able to experiment easily with different color combinations without changing the attribute setting for the graphics data structure • When a color value in the color table is changed, all pixels with that color index will change to the new color • Without color table, we can only change the color of a pixel by storing the new color at that frame buffer location

  11. Point

  12. Point Attributes • Two attributes of point • Color • Set with RGB values or an index into a color table • Size • An integer multiple of the pixel size • Large point is displayed as a square block of pixels

  13. Line

  14. Line Attributes • Basic attributes • Color • Set with the same function for all graphics primitives (using RGB values) • Width • Define with separate line functions • Style • Define with separate line functions • Special effects for lines • Pen • Brush • Strokes

  15. Line Width • A standard width line is generated with single pixels at each sample position • Thicker lines are displayed as positive integer multiplies of the standard line • Methods • If line slope magnitude ≤ 1.0 use vertical span • Plotting a vertical span of pixels in each column (x position) along the line. • If line slope magnitude > 1.0 use horizontal span • Plotting a pixels to the right and left of the line path.

  16. Line Width • Advantage vertical/horizontal span pixel • Quick to generate the thick line • Disadvantage • The displayed width of a line is dependent to its slope • i.e. 45 degree line will displayed thinner compare to vertical and horizontal line • The line ends are horizontal or vertical regardless of the slope of the line • Solution • Adjust the shape of the line ends to give them a better appearance

  17. Shape of the Line Ends Square ends that are perpendicular to the line path Line ends are added with a filled semi circle. Centered at the middle of the thick line. Diameter = the line thickness Extend the line and add butt caps that are positioned ½ of the line width

  18. Line Width • Other approach producing a thick line • Displaying the line as a filled rectangle • Generating the line with a selected pen or brush

  19. Smooth Connection Line Segment Method discussed will not produce a smoothly connected series of line segments It leaves pixels gaps at boundary between line segments with different slope where there is a shift from horizontal pixel spans to vertical pixel spans Additional processing at the segment endpoints is required to solve the problem

  20. 3 possible methods for smoothly joining 2 line segments Smooth Connection Line Segment Extending the outer boundaries of each of the two line segments until they meet Capping the connecting between two segments with a circular boundary whose diameter = line width Displaying the line segments with butt caps and filling in the triangular gap where the segments meet

  21. Line Style • Type • Solid • Dotted – very short dash with spacing equal to or greater than dash itself • Dashed – displayed by generating an interdash spacing • Pixel count for the span and interspan length is specified by the mask • E.g. 111100011110001111 • Note: fixed pixel with dashes can produce unequal length dashes. It depends on line orientation. So need to adjust the number of plotted pixel for different slopes

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

  23. Curve Attributes • Similar to line: type + width • Thicker curve can be produced by • Plotting additional pixel • Filling the space between two concentric circles • Using thicker pen or brush

  24. Character

  25. Character Attributes • We control the appearance of displayed character with attributes such as • Font size • Color • Orientation

  26. Character Attributes • Text-display option • Typeface – choice of font • Set of character with a particular design • i.e. courier, helvetica, times roman etc. • Assorted underlining styles • Solid, dotted, double • Boldface • Italic • Emboss • Shadow style

  27. Character Attributes • Color settings • Can be stored in the system attribute list and used by the procedures that generate character definition in the frame buffer • Current color is used to set pixel values in the frame buffer corresponding to the character shapes and position

  28. Character Attributes • Text size • By scaling the overall dimensions of character • Height • Width • Or scaling the height only • Or scaling the width only

  29. Character Attributes • Orientation • Set according to the direction of a character up vector • Orientation of character from baseline to capline is in the direction of up vector • Set using text-path orientation • Arrange the character strings vertically or horizontally or forward or backward • Adjust the position of the individual characters in the frame buffer according to the option selected • Combination of up-vector and text-path to produce slanted text

  30. Character Attributes • Other attributes • Character spacing • Spacing between character • Alignment • How text is to be displayed with respect to a reference position • Align according to the base line • Align according to the character center • Text-precision attribute (in some graphics packages) • Specify the amount of detail and the particular processing options that are to be used with the text string • Special character

  31. Antialiasing

  32. Antialiasing • A methods that compensate for the undersampling process (aliasing) • Aliasing • Is a distortion of information due to low-frequency sampling (under-sampling) • The sampling process digitizes coordinate points on an object to discrete integer pixel position • Resulting • A jagged, or stair-step appearance

  33. Antialiasing

  34. Antialiasing • One way to increase sampling rate with raster system • Simply to display objects at higher resolution • Even with highest resolution, the jaggies still apparent to some extent • So it is not a complete solution • Other antialising method may be applied

  35. Antialiasing Methods • Supersampling Straight Line Segments • Divide each pixel into a number of subpixels and count the number of subpixels that overlap the line path. • The intensity level is for each pixel is then set to a value that is proportional to this subpixel count. • Involve computing intensities at subpixel grid position, then combine the results to obtain the pixel intensities • Area sampling (prefiltering) • Determine pixel intensity by calculating the areas of overlap of each pixel with the object to be displayed • Pixel phasing • Shifting the display location of pixel areas • Applied by “micropositioning” the electron beam in relation to object geometry • Filtering techniques (postfiltering) • More accurate method for antialiasing lines • Methods similar to applying a weighted pixel mask, but now we imagine a continuous weighting surface covering the pixel • Antialiasing Area Boundary • Applying an antialiasing concepts for boundaries area

  36. References http://www.gamegen.com.br/

More Related