2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers.

Slides:



Advertisements
Similar presentations
Polygon Scan Conversion – 11b
Advertisements

Computer Graphics- SCC 342
Line Drawing Algorithms. Rasterization-Process of determining which pixels give the best approximation to a desired line on the screen. Scan Conversion-Digitizing.
CHAPTER 3 2D GRAPHICS ALGORITHMS
Computer Graphics Tz-Huan Huang National Taiwan University (Slides are based on Prof. Chen’s)
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
Graphics Pipeline.
© 2001 By Default! A Free sample background from Slide 1 Attributes of Output Primitives Definition Parameter that affects.
Different types of Polygons Simple Convex Simple Concave Non-simple : self-intersecting With holes ConvexConcaveSelf-intersecting.
CS 376 Introduction to Computer Graphics 02 / 05 / 2007 Instructor: Michael Eckmann.
Output Primitives Computer Graphics.
Implementation Dr. Amy Zhang. Reading 2  Hill, Chapters  Hill, Chapter 10.
CS 376 Introduction to Computer Graphics 02 / 07 / 2007 Instructor: Michael Eckmann.
Graphics Programming: Polygon Filling
CST 494/598 Computer Graphics Anshuman Razdan i3dea.asu.edu/razdan.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
CS 454 Computer graphics Polygon Filling
Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008.
CS 4731: Computer Graphics Lecture 22: Raster Graphics Part 3 Emmanuel Agu.
TOPIC 4 PART III FILL AREA PRIMITIVES POLYGON FILL AREAS CGMB214: Introduction to Computer Graphics.
1 CSCE 441: Computer Graphics Scan Conversion of Polygons Jinxiang Chai.
March Shape Drawing Algorithms Shmuel Wimer Bar Ilan Univ., Engineering Faculty.
CGMB 314 Intro to Computer Graphics Fill Area Primitives.
1/24/20061 Fill-Area Algorithms and Functions. 1/24/20062 Learning Objectives OpenGL state variables Color and gray scale Color functions Point attributes.
Polygon Scan Conversion and Z-Buffering
Geometric Objects Computer Graphics Lab. Sun-Jeong Kim.
COMPUTER GRAPHICS Prepared by S.MAHALAKSHMI Asst. Prof(Sr) / SCSE VIT University.
CGMB214: Introduction to Computer Graphics
1/1/20001 Topic >>>> Scan Conversion CSE Computer Graphics.
Dr. S.M. Malaek Assistant: M. Younesi
Tools for Raster Displays CVGLab Goals of the Chapter To describe pixmaps and useful operations on them. To develop tools for copying, scaling, and rotating.
3/4/04© University of Wisconsin, CS559 Spring 2004 Last Time Clipping Lines –Cohen-Sutherland: The use of outcodes and early reject/accept tests –Liang-Barsky:
Graphics Graphics Korea University cgvr.korea.ac.kr Raster Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing.
INT 840E Computer graphics Introduction & Graphic’s Architecture.
2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
10/15/02 (c) 2002 University of Wisconsin, CS559 Who Am I? Prof Stephen Chenney These notes will be online after the lecture – in fact they’re online already.
Attributes of Graphics Primitives Hearn & Baker Chapter 4 Some slides are taken from Robert Thomsons notes.
1 CSCE 441 Lecture 2: Scan Conversion of Lines Jinxiang Chai.
In the name of God Computer Graphics. Today Introduction Sampling Graphic Output Primitives 1.Line 2.Circle 3.Curve 4.polygon.
Computer Graphics Filling. Filling Polygons So we can figure out how to draw lines and circles How do we go about drawing polygons? We use an incremental.
Lecture 15: Raster Graphics and Scan Conversion
1 CSCE 441: Computer Graphics Scan Conversion of Polygons Jinxiang Chai.
2/28/2016 CS 551 / 645: Introductory Computer Graphics Framebuffer Mathematical Foundations The Rendering Pipeline.
CS552: Computer Graphics Lecture 17: Scan Conversion (Special Cases)
OUTPUT PRIMITIVES A.Aruna/Faculty of Information technology/SNSCE13/19/2016.
Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.
Rasterization Overview Raster Display Device. Scan Conversion / Rasterization: converting vector graphics into raster graphics (determining pixels in.
Computer Graphics CC416 Week 14 Filling Algorithms.
Attributes of Graphics Primitives Chapter 4
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
ATTRIBUTE OF OUTPUT PRIMITIVES. Attribute of Output Primitives 30/9/2008 A.Aruna/Assistant professor/IT/SNSCE 2 Definition Line Attribute Curve Attribute.
OUTPUT PRIMITIVES CEng 477 Computer Graphics METU, 2004.
Pattern filling in scan-conversion Antialiasing
CSCE 441 Lecture 2: Scan Conversion of Lines
Attributes of Graphics Primitives Hearn & Baker Chapter 4
Computer Graphics Filling.
Introduction to Polygons
Computer Graphics Filled Area Primitives II Lecture 09 Taqdees A
Agenda Polygon Terminology Types of polygons Inside Test
Agenda Polygon Terminology Types of polygons Inside Test
Chapter 3 Graphics Output Primitives
Primitive Drawing Algorithm
Primitive Drawing Algorithm
Polygons.
Presentation transcript:

2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers

Filling area Polygons are considered! 1)Scan-Line Filling (between edges) 2)Interactive Filling (using an interior starting point)

1) Scan-Line Filling (scan conversion) Problem: Given the vertices or edges of a polygon, which are the pixels to be included in the area filling?

Scan-Line filling, cont’d Main idea: locate the intersections between the scan-lines and the edges of the polygon sort the intersection points on each scan-line on increasing x-coordinates generate frame-buffer positions along the current scan-line between pairwise intersection points

Main idea

Scan-Line filling, cont’d Problems with intersection points that are vertices: Basic rule: count them as if each vertex is being two points (one to each of the two joining edges in the vertex) Exception: if the two edges joining in the vertex are on opposite sides of the scan-line, then count the vertex only once (require some additional processing)

Vertex problem

Scan-Line filling, cont’d Time-consuming to locate the intersection points! If an edge is crossed by a scan-line, most probably also the next scan-line will cross it (the use of coherence properties)

Scan-Line filling, cont’d Each edge is well described by an edge- record: y max x 0 (initially the x related to y min )  x/  y (inverse of the slope) (possibly also  x and  y)  x/  y is used for incremental calculations of the intersection points

Edge Records

Scan-Line filling, cont’d The intersection point (x n,y n ) between an edge and scan-line y n follows from the line equation of the edge: y n =  y/  x. x n + b (cp. y = m. x + b) The intersection between the same edge and the next scan-line y n+1 is then given from the following: y n+1 =  y/  x. x n+1 + b and also y n+1 = y n + 1 =  y/  x. x n + b +1

Scan-Line filling, cont’d This gives us: x n+1 = x n +  x/  y, n = 0, 1, 2, ….. i.e. the new value of x on the next scan- line is given by adding the inverse of the slope to the current value of x

Scan-Line filling, cont’d An active list of edge records intersecting with the current scan-line is sorted on increasing x-coordinates The polygon pixels that are written in the frame buffer are those which are calculated to be on the current scan-line between pairwise x-coordinates according to the active list

Scan-Line filling, cont’d When changing from one scan-line to the next, the active edge list is updated: a record with y max < ”the next scan-line” is removed in the remaining records, x 0 is incremented and rounded to the nearest integer an edge with y min = ”the next scan-line” is included in the list

Scan-Line Filling Example

2) Interactive Filling Given the boundaries of a closed surface. By choosing an arbitrary interior point, the complete interior of the surface will be filled with the color of the user’s choice.

Interactive Filling, cont’d Definition: An area or a boundary is said to be 4-connected if from an arbitrary point all other pixels within the area or on the boundary can be reached by only moving in horizontal or vertical steps. Furthermore, if it is also allowed to take diagonal steps, the surface or the boundary is said to be 8-connected.

4/8-connected

Interactive Filling, cont’d A recursive procedure for filling a 4- connected (8-connected) surface can easily be defined. Assume that the surface shall have the same color as the boundary (can easily be modified!). The first interior position (pixel) is choosen by the user.

Interactive Filling, algorithm void fill(int x, int y, int fillColor) { int interiorColor; interiorColor = getPixel(x,y); if (interiorColor != fillColor) { setPixel(x, y, fillColor); fill(x + 1, y, fillColor); fill(x, y + 1, fillColor); fill(x - 1, y, fillColor); fill(x, y - 1, fillColor); } }

Inside-Outside test When is a point an interior point? Odd-Even Rule Draw conceptually a line from a specified point to a distant point outside the coordinate space; count the number of polygon edges that are crossed if odd => interior if even => exterior Note! The vertices!

Text Representation: * bitmapped (raster) + fast - more storage - less good for styles/sizes * outlined (lines and curves) + less storage + good for styles/sizes - slower

Other output primitives * pattern (to fill an area) normally, an n x m rectangular color pixel array with a specified reference point * polymarker (marker symbol) a character representing a point * (polyline) a connected sequence of line segments

Attributes Influence the way a primitive is displayed Two main ways of introducing attributes: 1)added to primitive’s parameter list e.g. setPixel(x, y, color) 2)a list of current attributes (to be updated when changed) e.g setColor(color); setPixel(x, y);

Attributes for lines Lines (and curves) are normally infinitely thin type –dashed, dotted, solid, dot-dashed, … –pixel mask, e.g width –problem with the joins; line caps are used to adjust shape pen/brush shape color (intensity)

Lines with width Line caps Joins

Attributes for area fill fill style –hollow, solid, pattern, hatch fill, … color pattern –tiling

Tiling Tiling = filling surfaces (polygons) with a rectangular pattern

Attributes for characters/strings style font (typeface) color size (width/height) orientation path spacing alignment

Text attributes

Text attributes, cont’d

Color as attribute Each color has a numerical value, or intensity, based on some color model. A color model typically consists of three primary colors, in the case of displays Red, Green and Blue (RGB) For each primary color an intensity can be given, either (integer) or 0-1 (float) yielding the final color 256 different levels of each primary color means 3x8=24 bits of information to store

Color representations Two different ways of storing a color value: 1)a direct color value storage/pixel 2)indirectly via a color look-up table index/pixel (typically 256 or 512 different colors in the table)

Color Look-up Table

37 Frame Buffers A frame buffer may be thought of as computer memory organized as a two-dimensional array with each (x,y) addressable location corresponding to one pixel. Bit Planes or Bit Depth is the number of bits corresponding to each pixel. A typical frame buffer resolution might be –640 x 480 x 8 –1280 x 1024 x 8 –1280 x 1024 x 24

38 Monochrome Display (Bit-map Display)

39 3-Bit Color Display

40 True Color Display 24 bit planes, 8 bits per color gun = 16,777,216

41 Color Map Look-Up Tables Extends the number of colors that can be displayed by a given number of bit-planes RG B RED GREEN BLUE Pixel displayed at x', y' Pixel in bit map at x', y' 0 x 0 y x max y Bit mapLook-up tableDisplay Video look-up table organization: each table entry is a 12 bit per entry. A pixel with value 67 is displayed on the screen with the red electron gun at 8/15 (binary 1000) of maximum, green at 2/15, and the blue is 1/15.

Antialiasing Aliasing ≈ the fact that exact points are approximated by fixed pixel positions Antialiasing = a technique that compensates for this (more than one intensity level/pixel is required)

Antialiasing, a method A polygon will be studied (as an example). Area sampling (prefiltering): a pixel that is only partly included in the exact polygon, will be given an intensity that is proportional to the extent of the pixel area that is covered by the true polygon

Area sampling P = polygon intensity B = background intensity f = the extent of the pixel area covered by the true polygon  pixel intensity = P*f + B*(1 - f) Note! Time consuming to calculate f