8
1 Image Buffers and Scan Conversion CS-184: Computer Graphics Prof. James O’Brien Overview The frame buffer Continuous versus discrete representations Straight lines Curves Filled Polygons Filling Algorithms Image Buffers Chunk of memory to hold an image Image made of pixels (finite area!) Pixels have variable semantics RGB, gray-scale, depth, others... May be mapped to special hardware Frame Buffer Efficiency Issues Nice OO code helps avoid bugs Indexing can be expensive Out of order access may cause excess paging Hardware often requires odd mappings Continuous versus Discrete

Overview - University of California, Berkeley

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

1

Image Buffersand

Scan Conversion

CS-184: Computer Graphics

Prof. James O’Brien

Overview

� The frame buffer� Continuous versus discrete representations� Straight lines� Curves� Filled Polygons� Filling Algorithms

Image Buffers

� Chunk of memory to hold an image� Image made of pixels (finite area!)� Pixels have variable semantics

– RGB, gray-scale, depth, others...

� May be mapped to special hardware

Frame Buffer

Efficiency Issues

� Nice OO code helps avoid bugs� Indexing can be expensive� Out of order access may cause excess paging� Hardware often requires odd mappings

Continuous versus Discrete

2

Continuous versus Discrete Continuous versus Discrete

� Pixels have finite size� Approximate desired locations

Straight Lines Straight Lines

Straight Lines

Note: Simplified version of algorithm... see text.

3

4

5

Straight Lines

� Bresenham method much faster than DDE� Does not suffer from float problems

� Can do similar for other primitives

Curves

Approximate curves with line segments

Filled Polygons Filled Polygons

Filled Polygons Filled Polygons

6

Filled Polygons Filled Polygons

Filled Polygons Filled Polygons

Filled Polygons

� Implement with

– Test in scanning code

– Tagging edges

– Adjusting vertex locations ( why a good option? )

– Others...

Filled Polygons

7

Filled Polygons Filled Polygons

Filled Polygons

Self-intersecting polygons

A polygon

Result from non-zero winding number test

Result from parity test

Flood Fill (paint bucket)

� Fill in pixels inside some boundary

8

Neighbors and Spans