cgmb214 introduction to computer graphics n.
Skip this Video
Loading SlideShow in 5 Seconds..
CGMB214: Introduction to Computer Graphics PowerPoint Presentation
Download Presentation
CGMB214: Introduction to Computer Graphics

Loading in 2 Seconds...

play fullscreen
1 / 36

CGMB214: Introduction to Computer Graphics - PowerPoint PPT Presentation

  • Uploaded on

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

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'CGMB214: Introduction to Computer Graphics' - mary

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cgmb214 introduction to computer graphics

CGMB214: Introduction to Computer Graphics

Topic 5

Attributes of Graphics Primitives


To understand the characteristic of a primitive

color and gray scale1
Color and Gray Scale

Color – A basic attribute for all primitives

Various color option depend on capabilities and design objectives of a particular system

rgb color components
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
rgb color components2
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
rgb color components3
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)
color tables1
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
point attributes
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
line attributes
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
line width
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.
line width1
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
shape of the line ends
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

line width2
Line Width
  • Other approach producing a thick line
    • Displaying the line as a filled rectangle
    • Generating the line with a selected pen or brush
smooth connection line segment
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

smooth connection line segment1
3 possible methods for smoothly joining 2 line segmentsSmooth 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

line style
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
pen and brush
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

curve attributes
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
character attributes
Character Attributes
  • We control the appearance of displayed character with attributes such as
    • Font size
    • Color
    • Orientation
character attributes1
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
character attributes2
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
character attributes3
Character Attributes
  • Text size
    • By scaling the overall dimensions of character
      • Height
      • Width
    • Or scaling the height only
    • Or scaling the width only
character attributes4
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
character attributes5
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
  • 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
  • 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
antialiasing methods
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