Scan Converting Text. Attributes of Output Primitives. CS 460/560 Computer Graphics. Binghamton University. EngiNet. Thomas J.

Size: px
Start display at page:

Download "Scan Converting Text. Attributes of Output Primitives. CS 460/560 Computer Graphics. Binghamton University. EngiNet. Thomas J."

Transcription

1 Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced in any form or by any electronic or mechanical means, including the use of information storage and retrieval systems, without written approval from the copyright owner The Research Foundation of the State University of New York CS 460/560 Computer Graphics Professor Richard Eckert Scan Converting Text Attributes of Output Primitives February 19,

2 Text and Characters Very important output primitive Many pictures require text Two general techniques used Bitmapped (raster) Stroked (outline) Bitmapped Characters Each character represented (stored) as a 2-D array Each element corresponds to a pixel in a rectangular character cell Simplest: each element is a bit (1=pixel on, 0=pixel off) Stroked Characters Each character represented (stored) as a series of line segments sometimes as more complex primitives Parameters needed to draw each stroke endpoint coordinates for line segments Characteristics of Bitmapped Characters Each character in set requires same amount of memory to store Characters can only be scaled by integer scaling factors --> "Blocky" appearance Difficult to rotate characters by arbitrary angles Fast (BitBLT) Characteristics of Stroked Characters Number of stokes (storage space) depends on complexity of character Each stroke must be scan converted ==> more time to display Easily scaled and rotated arbitrarily just transform each stroke Example Character-Display Algorithms See CS-460/560 Notes Web Pages: Links to: An illustration of how to display bitmapped characters An illustration of how to display stroked characters 2

3 Algorithm for Bitmapped Characters--an Example 1. Define bitmap for the letter--e.g. T int t[7][7] = { {0,0,0,0,0,0,0}, {0,1,1,1,1,1,0}, {0,0,0,1,0,0,0}, {0,0,0,1,0,0,0}, {0,0,0,1,0,0,0}, {0,0,0,1,0,0,0}, {0,0,0,0,0,0,0}}; // bitmap for T [Could have a file with the bitmap descriptions of each character in the character set to be displayed] Not the most efficient way of doing it Could have used individual bits Algorithm would be more complex Bitmapped Character Algorithm, Continued 2. Define a function to display bitmap letter[][] at pixel coordinates (x,y) disp_letter (int x, int y, int letter[7][7]) { int i,j; for (i=0; i<7; i++) for (j=0; j<7; j++) if (letter[i][j] == 1) Setpixel(x+j,y+i); // plot from bitmap} 3. Call the function, passing desired bitmap disp_letter (50,100,t); // draw a 'T' at (50,100) Algorithm for Stroked Characters 1. Define a character (CH) type: typedef struct tagch { int n; POINT * pts; } CH; pts is an array of stroke endpoint vertices n is the number of vertices Stroked Character Algorithm, Continued 2. Define generic display-character function Strokes are specified in variable c (type CH) Display at pixel coordinates (xx,yy): disp_char (int xx, int yy, CH c) { int i, n_strokes; n_strokes=c.n/2; // n points ==> n/2 strokes for (i=0; i<n_strokes; i++) } line(xx+c.pts[2*i].x,yy+c.pts[2*i].y, xx+c.pts[2*i+1].x, yy+c.pts[2*i+1].y); Stroked Character Algorithm, Continued 3. Define the character's CH structure The following could be for an 'F': POINT p[6]; CH f; p[0].x=0; p[0].y=0; p[1].x=0; p[1].y=10; p[2].x=0; p[2].y=0; p[3].x=10; p[3].y=0; p[4].x=0; p[4].y=5; p[5].x=6; p[5].y=5; f.n = 6; f.pts = p; [Descriptions of each character in the character set could be stored in a file] Stroked Character Algorithm, Continued 4. Call the character-display function, passing it the desired character (CH) disp_char (50,100,f); // draw F at (50,100) 3

4 OpenGLCharacter Functions Only low-level support in basic OpenGL library Explicitly define characters as bitmaps Display by mapping selected sequence of bitmaps to adjacent positions in frame buffer (BitBLTing) OpenGL GLUT Text Support Some predefined character sets in GLUT: 1. GLUT Bitmapped: Display with glutbitmapcharacter(font, ch); font: constant type face to be used GLUT_BITMAP_8_BY_15 (fixed-width) GLUT_BITMAP_TIMES_ROMAN_10 (variable width) Others are available ch: ASCII code of character Position with glrasterposition2i(x,y); Example: glrasterposition2i(20,10); glutbitmapcharacter(glut_bitmap_8_15, A ); x coordinate is incremented by width of character after display 2. GLUT Stroked Characters: glutstrokecharacter(font, ch); Font: GLUT_STROKE_ROMAN (proportional spacing) GLUT_STROKE_MONO_ROMAN (constant spacing) Ch: ASCII code of character Size & position determined by specifying transformation operations We ll see these later Character Fonts in Windows FONT--Typeface, style, size of characters in a character set Three kinds of Windows Fonts Stock Fonts Logical or GDI Fonts Device Fonts Windows Stock Fonts Built into Windows Always available Windows Logical or GDI Fonts Defined in separate font resource files on disk.fon file (Stroke or Raster).fot/.ttf file (TrueType) Specific instance must be created 4

5 Windows Stroke Fonts Consist of line/curve segments Continuously scalable Slow to draw Legibility not too good Windows Raster Fonts Bitmaps so: Scaling by non-integer factors difficult Fast to display Legibility very good Windows TrueType Fonts Windows TrueType Fonts Rasterized stroke fonts so: Stored as strokes with hints to convert to bitmap Conversion called rasterization Continuously scalable Fast to display Legibility very good Combine best of both stroke and raster fonts Device Fonts Native to output device e.g., built-in printer fonts Postscript Using Windows Stock Fonts Like stock pens, brushes Accessed with: GetStockObject(font_name); Returns a handle to a font Use by selecting into DC with SelectObject(): Or -- CDC::SelectStockObject(font_name); 5

6 Using Windows Logical Fonts Instantiate a CFont object Use CFont::CreateFont(14 params!!) Specify characteristics Interpolates data from font file --> new sizes, bold, rotated, etc. Select CFont object into the DC Called logical since determined by program logic not just file contents See online help Windows Text Metrics CreateFont () may not give you exactly what you ask for Can use CDC::GetTextMetrics() to find out font details Gives lots of information in a TEXTMETRIC structure Commonly used to determine font size can be used to set line spacing, caret size, sizes of buttons, etc. Windows Text Metrics Computer Graphics Attributes Line and Text Attributes Fonts in Windows Area Fill Boundary/Flood Fill Algorithms Scanline Polygon Fill Algorithm Attributes How primitives are to be displayed Most systems use modal attributes Values in effect until changed Text Attributes Font (typeface) Character set with particular design style Display style underlined, italic, boldface, outlined, strikeout, spacing, etc. Color Size (width, height)--specified in points Point = 1/72 inch 6

7 Text Attributes, continued Orientation--how much character is rotated Escapement--orientation of line between first & last character in a string Color Width Line Attributes Style--solid, dotted, dashed, etc. Can be specified by giving a pattern array e.g., pat[]={1,1,1,1,1,1,0,0} Repeat this pattern on entire line: i th pixel along line: if (pat[i%8]==1) SetPixel(x,y) In Windows, use a pen (CPen) Area Fill Important for any closed output primitive Polygons, Circles, Ellipses, etc. Attributes: fill color fill pattern 2 Types of area fill algorithms: Boundary/Flood Fill Algorithms Scanline Algorithms Area Fill Algorithms See CS-460/560 Notes Web Page Link to: Week 5-BC: Area Fill Algorithms URL: /fillalgs.htm Boundary/Flood Fill Algorithms Determine which points are inside from pixel color information e.g., interior color, boundary color, fill color, current pixel color Color the ones that are inside. Scanline Algorithms Examine horizontal scanlines spanning area Find intersection points between current scanline and borders Color pixels along the scanline between alternate pairs of intersection points Especially useful for filling polygons polygon intersection point calculations are very simple Use vertical and horizontal coherence to get new intersection points from old rapidly 7

8 Boundary/Flood Fill Algorithms Determine which points are inside from pixel color information e.g., interior color, boundary color, fill color, current pixel color Color the ones that are inside. Connected Area Boundary Fill Algorithm For arbitrary closed areas Input: Boundary Color (BC), Fill Color (FC) (x,y) coordinates of seed point known to be inside Define a recursive BndFill(x,y,BC,FC) function: If pixel (x,y) not set to BC or FC, then set to FC Call BndFill() for neighboring points To be able to implement this, need an inquire function e.g., Windows GetPixel(x,y) returns color of pixel at (x,y) The BndFill() Function BndFill(x,y,BC,FC) { color = GetPixel(x,y) if ( (color!= BC) && (color!= FC) ) { SetPixel(x,y,FC); BndFill(x+1,y,BC,FC); BndFill(x,y+1,BC,FC); BndFill(x-1,y,BC,FC); BndFill(x,y-1,BC,FC); } } This would be called by code like: BndFill(50,100,5,8); // 5,8 are colors Windows GDI: colors are COLORREFs RGB() macro could be used As given, only works with 4-connected regions Boundary must be of a single color Could have multiple interior colors 8

9 Flood Fill Algorithm A variation Boundary Fill Fill area identified by the interior color instead of boundary color Good for single colored area with multicolor border Ups & Downs of Boundary / Flood Fill Big Up: Can be used for arbitrary areas! BUT-- Deep Recursion so: Uses enormous amounts of stack space (Adjust stack size before building in Windows!) Also very slow since: Extensive pushing/popping of stack Pixels may be visited more than once GetPixel() & SetPixel() called for each pixel 2 accesses to frame buffer for each pixel plotted Adjusting Stack Size in VC++ Project on Main Menu Properties Configuration Properties Linker System Stack Reserve Size: perhaps Stack Commit Size: perhaps Scanline Polygon Fill Algorithm Look at individual scan lines Compute intersection points with polygon edges Fill between alternate pairs of intersection points More specifically: For each scanline spanning the polygon: Find intersection points with all edges the current scanline cuts Sort intersection points by increasing x Turn on all pixels between alternate pairs of intersection points But-- There may be a problem with intersection points that are polygon vertices 9

10 Preprocessing non-max/min intersection points Vertex intersection points that are not local max or min must be preprocessed! Move lower endpoint of upper edge up by one pixel i.e., y <-- y + 1 What about x? m =? y/? x, so?x = (1/m) *? y But? y = 1, so: x <-- x + 1/m Preprocessing Active Edge A polygon edge intersected by the current scanline As polygon is scanned, edges will become active and inactive. Criterion for activating an edge: ysl = ymin of the edge (Here ysl = y of current scanline) Criterion for deactivating an edge: ysl = ymax of the edge Vertical & Horizontal Coherence Moving from one scanline to next: y = y + 1 If edge remains active, new intersection point coordinates will be: ynew = yold + 1 xnew = xold + 1/m (1/m = inverse slope of edge) Scanline Polygon Fill Algorithm Input List of polygon vertices (xi,yi) 10

11 Scanline Polygon Fill Algorithm Data Structures 1. Edge table: For each edge: edge #, ymin, ymax, x, 1/m 2. Activation Table: (y, edge number activated at y) Provides edge(s) activated for each new scanline Constructed by doing a "bin" or "bucket" sort 3. Active Edge List (AEL): Active edge numbers sorted on x A dynamic data structure Bin Sort for Activation Table Scanline Polygon Fill Algorithm 1. Set up edge table from vertex list; determine range of scanlines spanning polygon (miny, maxy ) 2. Preprocess edges with nonlocal max/min endpoints 3. Set up activation table (bin sort) 4. For eachscanline spanned by polygon: Add new active edges to AEL using activation table Sort active edge list on x Fill between alternate pairs of points (x,y) in order of sorted active edges For each edge e in active edge list: If (y!=ymax [e]) Compute & store new x (x+=1/m) Else Delete edge e from the active edge list Scanline Polygon Fill Algorithm Example Scanline Poly Fill Alg. (with example Data) 11

Text in OpenGL and Windows. Computer Graphics Attributes. Computer Graphics. Binghamton University. EngiNet. Thomas J. Watson

Text in OpenGL and Windows. Computer Graphics Attributes. Computer Graphics. Binghamton University. EngiNet. Thomas J. Watson Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced

More information

Scan Converting Circles

Scan Converting Circles Scan Conversion Algorithms CS 460 Computer Graphics Professor Richard Eckert Circles Ellipses and Other 2-D Curves Text February 16, 2004 Scan Converting Circles Given: Center: (h,k) Radius: r Equation:

More information

Video of BALSA Scanline Poly Fill Algorithm Animator CS 460. Computer Graphics. Scanline Polygon Fill Algorithm

Video of BALSA Scanline Poly Fill Algorithm Animator CS 460. Computer Graphics. Scanline Polygon Fill Algorithm CS 460 Computer Graphics Professor Richard Eckert February 25/27, 2004 1. Area Fill Boundary/Flood Fill Scanline Polygon Fill Scanline Boundary Fill Pattern Fill 2. Transformations Scanline Polygon Fill

More information

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1 Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes Line Attributes Fill-Area Attributes Scan-Line

More information

Einführung in Visual Computing

Einführung in Visual Computing Einführung in Visual Computing 186.822 Rasterization Werner Purgathofer Rasterization in the Rendering Pipeline scene objects in object space transformed vertices in clip space scene in normalized device

More information

2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line

2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line walters@buffalo.edu CSE 480/580 Lecture 8 Slide 1 2D Graphics Primitives II Additional issues in scan converting lines 1)Endpoint order Want algorithms to draw the same pixels for each line How handle?

More information

General Hidden Surface Removal Algorithms. Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science CS 460/560

General Hidden Surface Removal Algorithms. Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science CS 460/560 Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced

More information

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1 Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes t Line Attributes Fill-Area Attributes Scan-Line

More information

Unit 2 Output Primitives and their Attributes

Unit 2 Output Primitives and their Attributes Unit 2 Output Primitives and their Attributes Shapes and colors of the objects can be described internally with pixel arrays or with sets of basic geometric structures, such as straight line segments and

More information

Attributes of Graphics Primitives

Attributes of Graphics Primitives ttributes for Graphics Output Primitives ttributes of Graphics Primitives in 2 points, lines polygons, circles, ellipses & other curves (also filled) characters in 3 triangles & other polygons anti-aliasing

More information

Graphics (Output) Primitives. Chapters 3 & 4

Graphics (Output) Primitives. Chapters 3 & 4 Graphics (Output) Primitives Chapters 3 & 4 Graphic Output and Input Pipeline Scan conversion converts primitives such as lines, circles, etc. into pixel values geometric description a finite scene area

More information

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi Output Primitives Dr. S.M. Malaek Assistant: M. Younesi Output Primitives Output Primitives: Basic geometric structures (points, straight line segment, circles and other conic sections, quadric surfaces,

More information

CS 543: Computer Graphics. Rasterization

CS 543: Computer Graphics. Rasterization CS 543: Computer Graphics Rasterization Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu (with lots

More information

Scan Conversion of Polygons. Dr. Scott Schaefer

Scan Conversion of Polygons. Dr. Scott Schaefer Scan Conversion of Polygons Dr. Scott Schaefer Drawing Rectangles Which pixels should be filled? /8 Drawing Rectangles Is this correct? /8 Drawing Rectangles What if two rectangles overlap? 4/8 Drawing

More information

Chapter 8: Implementation- Clipping and Rasterization

Chapter 8: Implementation- Clipping and Rasterization Chapter 8: Implementation- Clipping and Rasterization Clipping Fundamentals Cohen-Sutherland Parametric Polygons Circles and Curves Text Basic Concepts: The purpose of clipping is to remove objects or

More information

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics Announcements Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class 1 Scan Conversion Overview of Rendering Scan Conversion Drawing Lines Drawing Polygons

More information

Polygon Filling. Can write frame buffer one word at time rather than one bit. 2/3/2000 CS 4/57101 Lecture 6 1

Polygon Filling. Can write frame buffer one word at time rather than one bit. 2/3/2000 CS 4/57101 Lecture 6 1 Polygon Filling 2 parts to task which pixels to fill what to fill them with First consider filling unclipped primitives with solid color Which pixels to fill consider scan lines that intersect primitive

More information

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Rasterization Rasterization (scan conversion)

More information

Rasterization, or What is glbegin(gl_lines) really doing?

Rasterization, or What is glbegin(gl_lines) really doing? Rasterization, or What is glbegin(gl_lines) really doing? Course web page: http://goo.gl/eb3aa February 23, 2012 Lecture 4 Outline Rasterizing lines DDA/parametric algorithm Midpoint/Bresenham s algorithm

More information

Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science. Computer Graphics. State University of New York.

Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science. Computer Graphics. State University of New York. Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced

More information

Filled Area Primitives. CEng 477 Introduction to Computer Graphics METU, 2007

Filled Area Primitives. CEng 477 Introduction to Computer Graphics METU, 2007 Filled Area Primitives CEng 477 Introduction to Computer Graphics METU, 2007 Filled Area Primitives Two basic approaches to area filling on raster systems: Determine the overlap intervals for scan lines

More information

COMP371 COMPUTER GRAPHICS

COMP371 COMPUTER GRAPHICS COMP371 COMPUTER GRAPHICS LECTURE 14 RASTERIZATION 1 Lecture Overview Review of last class Line Scan conversion Polygon Scan conversion Antialiasing 2 Rasterization The raster display is a matrix of picture

More information

Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science. Computer Graphics. State University of New York.

Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science. Computer Graphics. State University of New York. Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced

More information

Chapter 3. Sukhwinder Singh

Chapter 3. Sukhwinder Singh Chapter 3 Sukhwinder Singh PIXEL ADDRESSING AND OBJECT GEOMETRY Object descriptions are given in a world reference frame, chosen to suit a particular application, and input world coordinates are ultimately

More information

Agenda. Polygon Terminology Types of polygons Inside Test Polygon Filling Algorithms. Scan-Line Polygon Fill Algorithm Flood-Fill Algorithm

Agenda. Polygon Terminology Types of polygons Inside Test Polygon Filling Algorithms. Scan-Line Polygon Fill Algorithm Flood-Fill Algorithm Polygons UNIT - III Agenda Polygon Terminology Types of polygons Inside Test Polygon Filling Algorithms Scan-Line Polygon Fill Algorithm Flood-Fill Algorithm A Polygon Vertex = point in space (2D or 3D)

More information

? Which intermediate. Recall: Line drawing algorithm. Programmer specifies (x,y) of end pixels Need algorithm to determine pixels on line path

? Which intermediate. Recall: Line drawing algorithm. Programmer specifies (x,y) of end pixels Need algorithm to determine pixels on line path Recall: Line drawing algorithm Programmer specifies (x,y) of end pixels Need algorithm to determine pixels on line path 8 7 6 5 4 3 2 1 (3,2) (9,6) Line: (3,2) -> (9,6)? Which intermediate pixels to turn

More information

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines COMP30019 Graphics and Interaction Scan Converting Polygons and Lines Department of Computer Science and Software Engineering The Lecture outline Introduction Scan conversion Scan-line algorithm Edge coherence

More information

CS 4731/543: Computer Graphics Lecture 7 (Part I): Raster Graphics: Polygons & Antialiasing. Emmanuel Agu

CS 4731/543: Computer Graphics Lecture 7 (Part I): Raster Graphics: Polygons & Antialiasing. Emmanuel Agu CS 4731/543: Computer Graphics Lecture 7 (Part I): Raster Graphics: Polygons & Antialiasing Emmanuel Agu So Far Raster graphics: Line drawing algorithms (simple, Bresenham s) Today: Defining and filling

More information

Computer Graphics Lecture Notes

Computer Graphics Lecture Notes Computer Graphics Lecture Notes UNIT- Overview of Computer Graphics. Application of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe

More information

UNIT 2 GRAPHIC PRIMITIVES

UNIT 2 GRAPHIC PRIMITIVES UNIT 2 GRAPHIC PRIMITIVES Structure Page Nos. 2.1 Introduction 46 2.2 Objectives 46 2.3 Points and Lines 46 2.4 Line Generation Algorithms 48 2.4.1 DDA Algorithm 49 2.4.2 Bresenhams Line Generation Algorithm

More information

Chapter - 2: Geometry and Line Generations

Chapter - 2: Geometry and Line Generations Chapter - 2: Geometry and Line Generations In Computer graphics, various application ranges in different areas like entertainment to scientific image processing. In defining this all application mathematics

More information

Topic #1: Rasterization (Scan Conversion)

Topic #1: Rasterization (Scan Conversion) Topic #1: Rasterization (Scan Conversion) We will generally model objects with geometric primitives points, lines, and polygons For display, we need to convert them to pixels for points it s obvious but

More information

CSC Computer Graphics

CSC Computer Graphics // CSC. Computer Graphics Lecture Kasun@dscs.sjp.ac.lk Department of Computer Science University of Sri Jayewardanepura Polygon Filling Scan-Line Polygon Fill Algorithm Span Flood-Fill Algorithm Inside-outside

More information

Computer Graphics CS 543 Lecture 11 (Part 1) Polygon Filling & Antialiasing

Computer Graphics CS 543 Lecture 11 (Part 1) Polygon Filling & Antialiasing Computer Graphics CS 543 Lecture 11 (Part 1) Polygon Filling & Antialiasing Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Defining and Filling Regions of Pixels Methods

More information

Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI) Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) OpenGL Stages After projection, several stages before objects drawn

More information

Rasterization: Geometric Primitives

Rasterization: Geometric Primitives Rasterization: Geometric Primitives Outline Rasterizing lines Rasterizing polygons 1 Rasterization: What is it? How to go from real numbers of geometric primitives vertices to integer coordinates of pixels

More information

1 Introduction to Graphics

1 Introduction to Graphics 1 1.1 Raster Displays The screen is represented by a 2D array of locations called pixels. Zooming in on an image made up of pixels The convention in these notes will follow that of OpenGL, placing the

More information

POLYGON FILLING ALGORITHM

POLYGON FILLING ALGORITHM POLYGON FILLING ALGORITHM http://www.tutorialspoint.com/computer_graphics/polygon_filling_algorithm.htm Copyright tutorialspoint.com Polygon is an ordered list of vertices as shown in the following figure.

More information

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines Emmanuel Agu 2D Graphics Pipeline Clipping Object World Coordinates Applying world window Object subset window to viewport mapping

More information

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1 General scheme of a 2D CG application 2D Image Synthesis Balázs Csébfalvi modeling image synthesis Virtual world model world defined in a 2D plane Department of Control Engineering and Information Technology

More information

Computer Graphics Geometry and Transform

Computer Graphics Geometry and Transform ! Computer Graphics 2014! 5. Geometry and Transform Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2014-10-11! Today outline Triangle rasterization Basic vector algebra ~ geometry! Antialiasing

More information

Last class. A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization

Last class. A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization Lecture 6 Last class Last lecture (clip coordinates): A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization normalized view

More information

Overview of Computer Graphics

Overview of Computer Graphics Application of Computer Graphics UNIT- 1 Overview of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe outline form. Multi-window

More information

Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading.

Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading. Group A Assignment No A1. Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading. Aim: To draw line using DDA and Bresenham s algorithm

More information

CSCI 4620/8626. Primitives and Attributes

CSCI 4620/8626. Primitives and Attributes CSCI 4620/8626 Computer Graphics Attributes of Graphics Primitives (Chapter 5) Last update: 2016-02-23 Primitives and Attributes The graphics primitives we ve seen so far are fundamental shapes, like lines,

More information

Graphics Output Primitives

Graphics Output Primitives Important Graphics Output Primitives Graphics Output Primitives in 2D polgons, circles, ellipses & other curves piel arra operations in 3D triangles & other polgons Werner Purgathofer / Computergraphik

More information

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers 1. How long would it take to load an 800 by 600 frame buffer with 16 bits per pixel

More information

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California CSCI 420 Computer Graphics Lecture 14 Rasterization Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California 1 Rasterization (scan conversion) Final step in pipeline:

More information

Raster Scan Displays. Framebuffer (Black and White)

Raster Scan Displays. Framebuffer (Black and White) Raster Scan Displays Beam of electrons deflected onto a phosphor coated screen Phosphors emit light when excited by the electrons Phosphor brightness decays -- need to refresh the display Phosphors make

More information

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into 2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into the viewport of the current application window. A pixel

More information

From Ver(ces to Fragments: Rasteriza(on

From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments 3D vertices vertex shader rasterizer fragment shader final pixels 2D screen fragments l determine fragments to be covered l interpolate

More information

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA) CSCI 420 Computer Graphics Lecture 14 Rasterization Jernej Barbic University of Southern California Scan Conversion Antialiasing [Angel Ch. 6] Rasterization (scan conversion) Final step in pipeline: rasterization

More information

CS488 2D Graphics. Luc RENAMBOT

CS488 2D Graphics. Luc RENAMBOT CS488 2D Graphics Luc RENAMBOT 1 Topics Last time, hardware and frame buffer Now, how lines and polygons are drawn in the frame buffer. Then, how 2D and 3D models drawing into the frame buffer Then, more

More information

(Refer Slide Time: 00:02:00)

(Refer Slide Time: 00:02:00) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 18 Polyfill - Scan Conversion of a Polygon Today we will discuss the concepts

More information

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li. Fall 2015 CSCI 420: Computer Graphics 7.1 Rasterization Hao Li http://cs420.hao-li.com 1 Rendering Pipeline 2 Outline Scan Conversion for Lines Scan Conversion for Polygons Antialiasing 3 Rasterization

More information

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005 INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Renderer Implementation: Basics and Clipping David Carr Virtual Environments, Fundamentals Spring 2005 Feb-28-05 SMM009, Basics and Clipping 1

More information

Introduction to 3D Graphics with OpenGL. Z-Buffer Hidden Surface Removal. Binghamton University. EngiNet. Thomas J. Watson

Introduction to 3D Graphics with OpenGL. Z-Buffer Hidden Surface Removal. Binghamton University. EngiNet. Thomas J. Watson Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced

More information

Clipping Lines. Dr. Scott Schaefer

Clipping Lines. Dr. Scott Schaefer Clipping Lines Dr. Scott Schaefer Why Clip? We do not want to waste time drawing objects that are outside of viewing window (or clipping window) 2/94 Clipping Points Given a point (x, y) and clipping window

More information

521493S Computer Graphics Exercise 1 (Chapters 1-3)

521493S Computer Graphics Exercise 1 (Chapters 1-3) 521493S Computer Graphics Exercise 1 (Chapters 1-3) 1. Consider the clipping of a line segment defined by the latter s two endpoints (x 1, y 1 ) and (x 2, y 2 ) in two dimensions against a rectangular

More information

Adding CSS to your HTML

Adding CSS to your HTML Adding CSS to your HTML Lecture 3 CGS 3066 Fall 2016 September 27, 2016 Making your document pretty CSS is used to add presentation to the HTML document. We have seen 3 ways of adding CSS. In this lecture,

More information

Scan Conversion. Drawing Lines Drawing Circles

Scan Conversion. Drawing Lines Drawing Circles Scan Conversion Drawing Lines Drawing Circles 1 How to Draw This? 2 Start From Simple How to draw a line: y(x) = mx + b? 3 Scan Conversion, a.k.a. Rasterization Ideal Picture Raster Representation Scan

More information

8. Hidden Surface Elimination

8. Hidden Surface Elimination 8. Hidden Surface Elimination Identification and Removal of parts of picture that are not visible from a chosen viewing position. 1 8. Hidden Surface Elimination Basic idea: Overwriting Paint things in

More information

UNIT 2. Translation/ Scaling/ Rotation. Unit-02/Lecture-01

UNIT 2. Translation/ Scaling/ Rotation. Unit-02/Lecture-01 UNIT 2 Translation/ Scaling/ Rotation Unit-02/Lecture-01 Translation- (RGPV-2009,10,11,13,14) Translation is to move, or parallel shift, a figure. We use a simple point as a starting point. This is a simple

More information

Computer Graphics 7 - Rasterisation

Computer Graphics 7 - Rasterisation Computer Graphics 7 - Rasterisation Tom Thorne Slides courtesy of Taku Komura www.inf.ed.ac.uk/teaching/courses/cg Overview Line rasterisation Polygon rasterisation Mean value coordinates Decomposing polygons

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Last Time? The Traditional Graphics Pipeline Reading for Today A Practical Model for Subsurface Light Transport, Jensen, Marschner, Levoy, & Hanrahan, SIGGRAPH 2001 Participating Media Measuring BRDFs

More information

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal Raster Displays and Scan Conversion Computer Graphics, CSCD18 Fall 28 Instructor: Leonid Sigal Rater Displays Screen is represented by 2D array of locations called piels y Rater Displays Screen is represented

More information

The American University in Cairo. Academic Computing Services. Word prepared by. Soumaia Ahmed Al Ayyat

The American University in Cairo. Academic Computing Services. Word prepared by. Soumaia Ahmed Al Ayyat The American University in Cairo Academic Computing Services Word 2000 prepared by Soumaia Ahmed Al Ayyat Spring 2001 Table of Contents: Opening the Word Program Creating, Opening, and Saving Documents

More information

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Clipping. Concepts, Algorithms for line clipping. 1 of 16. Andries van Dam. Clipping - 10/12/17

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Clipping. Concepts, Algorithms for line clipping. 1 of 16. Andries van Dam. Clipping - 10/12/17 Clipping Concepts, Algorithms for line clipping 1 of 16 Line Clipping in 2D Clipping endpoints If x min x x max and y min y y max, the point is inside the clip rectangle. Endpoint analysis for lines: if

More information

Chapter 14. Drawing in a Window

Chapter 14. Drawing in a Window Chapter 14 Drawing in a Window 1 The Window Client Area (P.664) A coordinate system that is local to the window. It always uses the upper-left corner of the client area as its reference point. 2 Graphical

More information

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives. D Graphics Primitives Eye sees Displays - CRT/LCD Frame buffer - Addressable pixel array (D) Graphics processor s main function is to map application model (D) by projection on to D primitives: points,

More information

8. Hidden Surface Elimination

8. Hidden Surface Elimination -04-8 Hidden Surface Elimination To eliminate edges and surfaces not visible to the viewer Two categories: Object space methods: Image space methods: deal with object definitions directly Order the surfaces

More information

Two basic types: image-precision and object-precision. Image-precision For each pixel, determine which object is visable Requires np operations

Two basic types: image-precision and object-precision. Image-precision For each pixel, determine which object is visable Requires np operations walters@buffalo.edu CSE 480/580 Lecture 21 Slide 1 Visible-Surface Determination (Hidden Surface Removal) Computationaly expensive Two basic types: image-precision and object-precision For n objects and

More information

CS475m - Computer Graphics. Lecture 1 : Rasterization Basics

CS475m - Computer Graphics. Lecture 1 : Rasterization Basics CS475m - Computer Graphics Lecture 1 : Rasterization Basics Image Formation Light Source Camera Image World Image Formation Light Source Incident Ray Camera Reflected Ray Image World Transmitted Ray Image

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Last Time? The Traditional Graphics Pipeline Participating Media Measuring BRDFs 3D Digitizing & Scattering BSSRDFs Monte Carlo Simulation Dipole Approximation Today Ray Casting / Tracing Advantages? Ray

More information

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by: Lecture 3 Output Primitives Assuming we have a raster display, a picture is completely specified by: - A set of intensities for the pixel positions in the display. - A set of complex objects, such as trees

More information

Creating a Basic Chart in Excel 2007

Creating a Basic Chart in Excel 2007 Creating a Basic Chart in Excel 2007 A chart is a pictorial representation of the data you enter in a worksheet. Often, a chart can be a more descriptive way of representing your data. As a result, those

More information

CSCI 4620/8626. Coordinate Reference Frames

CSCI 4620/8626. Coordinate Reference Frames CSCI 4620/8626 Computer Graphics Graphics Output Primitives Last update: 2014-02-03 Coordinate Reference Frames To describe a picture, the world-coordinate reference frame (2D or 3D) must be selected.

More information

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k Idea 1 m 0 candidates last pixel Note that line could have passed through any part of this pixel Decision variable: d = x(a-b) d is an integer d < 0 use upper pixel d > 0 use lower pixel Incremental Form

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Final Projects Proposals due Thursday 4/8 Proposed project summary At least 3 related papers (read & summarized) Description of series of test cases Timeline & initial task assignment The Traditional Graphics

More information

CS488. Visible-Surface Determination. Luc RENAMBOT

CS488. Visible-Surface Determination. Luc RENAMBOT CS488 Visible-Surface Determination Luc RENAMBOT 1 Visible-Surface Determination So far in the class we have dealt mostly with simple wireframe drawings of the models The main reason for this is so that

More information

CS 325 Computer Graphics

CS 325 Computer Graphics CS 325 Computer Graphics 02 / 06 / 2012 Instructor: Michael Eckmann Today s Topics Questions? Comments? Antialiasing Polygons Interior points Fill areas tiling halftoning dithering Antialiasing Aliasing

More information

Points and lines. x x 1 + y 1. y = mx + b

Points and lines. x x 1 + y 1. y = mx + b Points and lines Point is the fundamental element of the picture representation. It is nothing but the position in a plan defined as either pairs or triplets of number depending on whether the data are

More information

Visibility: Z Buffering

Visibility: Z Buffering University of British Columbia CPSC 414 Computer Graphics Visibility: Z Buffering Week 1, Mon 3 Nov 23 Tamara Munzner 1 Poll how far are people on project 2? preferences for Plan A: status quo P2 stays

More information

IT82: Mul timedia. Practical Graphics Issues 20th Feb Overview. Anti-aliasing. Fonts. What is it How to do it? History Anatomy of a Font

IT82: Mul timedia. Practical Graphics Issues 20th Feb Overview. Anti-aliasing. Fonts. What is it How to do it? History Anatomy of a Font IT82: Mul timedia Practical Graphics Issues 20th Feb 2003 1 Anti-aliasing What is it How to do it? Lines Shapes Fonts History Anatomy of a Font Overview Types of Fonts ( which do I choose? ) How to make

More information

Computer Graphics Geometry and Transform

Computer Graphics Geometry and Transform Computer Graphics 2012 5. Geometry and Transform Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2012-09-26 上机实践 地址 :ftp://give.zju.edu.cn 用户 :cgzhang 密码 :cgzhang 请大家把上机作业结果和报告内容, 上传至 学号 _ 姓名

More information

Clipping and Scan Conversion

Clipping and Scan Conversion 15-462 Computer Graphics I Lecture 14 Clipping and Scan Conversion Line Clipping Polygon Clipping Clipping in Three Dimensions Scan Conversion (Rasterization) [Angel 7.3-7.6, 7.8-7.9] March 19, 2002 Frank

More information

Pipeline implementation II

Pipeline implementation II Pipeline implementation II Overview Line Drawing Algorithms DDA Bresenham Filling polygons Antialiasing Rasterization Rasterization (scan conversion) Determine which pixels that are inside primitive specified

More information

Drill Table. Summary. Modified by Phil Loughhead on 16-Jun Parent page: PCB Dialogs

Drill Table. Summary. Modified by Phil Loughhead on 16-Jun Parent page: PCB Dialogs Drill Table Old Content - visit altium.com/documentation Modified by Phil Loughhead on 16-Jun-2015 Parent page: PCB Dialogs The Drill Table Dialog. Summary A standard element required for manufacture of

More information

Display Technologies: CRTs Raster Displays

Display Technologies: CRTs Raster Displays Rasterization Display Technologies: CRTs Raster Displays Raster: A rectangular array of points or dots Pixel: One dot or picture element of the raster Scanline: A row of pixels Rasterize: find the set

More information

From Vertices To Fragments-1

From Vertices To Fragments-1 From Vertices To Fragments-1 1 Objectives Clipping Line-segment clipping polygon clipping 2 Overview At end of the geometric pipeline, vertices have been assembled into primitives Must clip out primitives

More information

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://bit.ly/hgvxlh / http://bit.ly/evizre Public

More information

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://bit.ly/hgvxlh / http://bit.ly/evizre Public

More information

Creating and editing vector maps

Creating and editing vector maps Software PHOTOMOD Module PHOTOMOD VectOr Creating and editing vector maps Racurs, Moscow, 2009 PHOTOMOD CONTENTS 1. GENERAL PURPOSE OF VECTOR MAP EDITOR... 3 2. VECTOR MAP EDITOR MANAGING.... 3 3. ADDING

More information

Rasterization. MIT EECS Frédo Durand and Barb Cutler. MIT EECS 6.837, Cutler and Durand 1

Rasterization. MIT EECS Frédo Durand and Barb Cutler. MIT EECS 6.837, Cutler and Durand 1 Rasterization MIT EECS 6.837 Frédo Durand and Barb Cutler MIT EECS 6.837, Cutler and Durand 1 Final projects Rest of semester Weekly meetings with TAs Office hours on appointment This week, with TAs Refine

More information

Implementation III. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Implementation III. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Objectives Survey Line Drawing Algorithms - DDA - Bresenham 2 Rasterization

More information

CS 184, Fall 1996 Midterm #1 Professor: unknown

CS 184, Fall 1996 Midterm #1 Professor: unknown CS 184, Fall 1996 Midterm #1 Professor: unknown Problem #1, Transformations (8pts) All questions assume a right handed coordinate system. Circle the correct answer: (2 pts each) a) In 3 space, two rotations

More information

Computer Graphics - Week 6

Computer Graphics - Week 6 Computer Graphics - Week 6 Bengt-Olaf Schneider IBM T.J. Watson Research Center Questions about Last Week? Questions about Assignment? Comments about submission Deadline is Friday, 2/26 at 5:30 pm Standard

More information

Adobe Photoshop Sh S.K. Sublania and Sh. Naresh Chand

Adobe Photoshop Sh S.K. Sublania and Sh. Naresh Chand Adobe Photoshop Sh S.K. Sublania and Sh. Naresh Chand Photoshop is the software for image processing. With this you can manipulate your pictures, either scanned or otherwise inserted to a great extant.

More information

BRAND GUIDELINES January 2017 leanconstruction.org

BRAND GUIDELINES January 2017 leanconstruction.org BRAND GUIDELINES January 2017 leanconstruction.org The Lean Construction Institute (LCI) is a non-profit organization, founded in 1997. The Institute operates as a catalyst to transform the industry through

More information

MANUAL NO. OPS647-UM-151 USER S MANUAL

MANUAL NO. OPS647-UM-151 USER S MANUAL MANUAL NO. OPS647-UM-151 USER S MANUAL Software Usage Agreement Graphtec Corporation ( Graphtec ) hereby grants the purchaser and authorized User (the User ) the right to use the software (the Software

More information