1. Application of Computer Graphics



Similar documents
COMP175: Computer Graphics. Lecture 1 Introduction and Display Technologies

Gursharan Singh Tatla Page No. 1 COMPUTER GRAPHICS (Short Answer type Questions)

Graphical displays are generally of two types: vector displays and raster displays. Vector displays

Lecture Notes, CEng 477

Comp 410/510. Computer Graphics Spring Introduction to Graphics Systems

Important Question with Answer

B2.53-R3: COMPUTER GRAPHICS. NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions.

Computer Graphics. Computer graphics deals with all aspects of creating images with a computer

Computer Graphics Lecture Notes

Overview. Raster Graphics and Color. Overview. Display Hardware. Liquid Crystal Display (LCD) Cathode Ray Tube (CRT)

Working With Animation: Introduction to Flash

Graphic Design. Background: The part of an artwork that appears to be farthest from the viewer, or in the distance of the scene.

Prof. Dr. M. H. Assal

ICS : 435. Computer Graphics Applications. Instructor : Da'ad Albalawneh

CSCA0201 FUNDAMENTALS OF COMPUTING. Chapter 4 Output Devices

The Keyboard One of the first peripherals to be used with a computer and is still the primary input device for text and numbers.

Computers: Tools for an Information Age. Chapter 5 Input and Output: The User Connection

Displays. Cathode Ray Tube. Semiconductor Elements. Basic applications. Oscilloscope TV Old monitors. 2009, Associate Professor PhD. T.

COMPUTER GRAPHICS IMPORTANT QUESTION AND ANSWERS. Computer graphics

ELECTRONIC DOCUMENT IMAGING

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

MMGD0203 Multimedia Design MMGD0203 MULTIMEDIA DESIGN. Chapter 3 Graphics and Animations

B.A IN GRAPHIC DESIGN

Discovering Computers. Technology in a World of Computers, Mobile Devices, and the Internet. Chapter 7. Input and Output

Basics of Computer 1.1 INTRODUCTION 1.2 OBJECTIVES

A Short Introduction to Computer Graphics

Adobe Illustrator CS5

Chapter 9 Input/Output Devices

Computer Graphics with OpenGL 3e

Adobe Illustrator CS5 Part 1: Introduction to Illustrator

Chapter 5 Understanding Input. Discovering Computers Your Interactive Guide to the Digital World

TH2. Input devices, processing and output devices

Introduction to Computer Graphics

G.H. Raisoni College of Engineering, Nagpur. Department of Information Technology

Chapter 5 Objectives. Chapter 5 Input

Computer Graphics. Dr. S.M. Malaek. Assistant: M. Younesi

ACE: Illustrator CC Exam Guide

10.1 FUNCTIONS OF INPUT AND OUTPUT DEVICES

How many PIXELS do you need? by ron gibbs

Computer Peripherals

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 9 The Game Engine

Introduction to Computers, Anatomy of Computers, Input and Output Devices

CAD/CAM. Hardware and software. CAD/CAM/CAE System. Shahrood University. Display Processing Unit

Elfring Fonts, Inc. PCL MICR Fonts

Pages Figure 6-1. Page 305

Understand the Sketcher workbench of CATIA V5.

ClarisWorks 5.0. Graphics

Thea Omni Light. Thea Spot Light. Light setup & Optimization

INTRODUCTION TO RENDERING TECHNIQUES

Help. Contents Back >>

TABLE OF CONTENTS. INTRODUCTION... 5 Advance Concrete... 5 Where to find information?... 6 INSTALLATION... 7 STARTING ADVANCE CONCRETE...

MassArt Studio Foundation: Visual Language Digital Media Cookbook, Fall 2013

Index SNo Lesson Lesson Name Author Vetter. 1 1 Overview of Computer Abhesik Taneja Dr. Pradeep Bhatia

Using SMART Notebook (Overview)

Fixplot Instruction Manual. (data plotting program)

The Keyboard One of the first peripherals to be used with a computer and is still the primary input device for text and numbers.


Computers Are Your Future Prentice-Hall, Inc.

Optical Design Tools for Backlight Displays

Digital Image Basics. Introduction. Pixels and Bitmaps. Written by Jonathan Sachs Copyright Digital Light & Color

Computer Peripherals

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur

Otis Photo Lab Inkjet Printing Demo

A System for Capturing High Resolution Images

2013 Getting Started Guide

ELFRING FONTS INC. MICR FONTS FOR WINDOWS

Overview of the Adobe Flash Professional CS6 workspace

Drawing Lines with Pixels. Joshua Scott March 2012

Scanners and How to Use Them

PowerPoint 2007 Basics Website:

QUICK REFERENCE: ADOBE ILLUSTRATOR CS2 AND CS3 SECTION 1: CS3 TOOL BOX: PAGE 2 SECTION 2: CS2 TOOL BOX: PAGE 11

Flash MX 2004 Animation Lesson

Computer Graphics Hardware An Overview

CREATING POSTERS WITH POWERPOINT

The six steps of Printing 1. Cleaning

C O M P U T E R G R A P H I C S. Computer Graphics. Introduction I. Guoying Zhao 1 / 58

CHAPTER 6: GRAPHICS, DIGITAL MEDIA, AND MULTIMEDIA

Chapter 5 Input. Chapter 5 Objectives. What Is Input? What Is Input? The Keyboard. The Keyboard

Guide To Creating Academic Posters Using Microsoft PowerPoint 2010

Lab 3. GIS Data Entry and Editing.

Correcting the Lateral Response Artifact in Radiochromic Film Images from Flatbed Scanners

CONFOCAL LASER SCANNING MICROSCOPY TUTORIAL

ACADEMIC TECHNOLOGY SUPPORT

Lession: 2 Animation Tool: Synfig Card or Page based Icon and Event based Time based Pencil: Synfig Studio: Getting Started: Toolbox Canvas Panels

Tomorrow s Technology and You

Maya 2014 Basic Animation & The Graph Editor

Preparing Images for PowerPoint, the Web, and Publication

Visualization of 2D Domains

REVISED JUNE PLEASE DISCARD ANY PREVIOUS VERSIONS OF THIS GUIDE. Graphic Style Guide

Digital Video-Editing Programs

Introduction To Computers: Hardware and Software

So you say you want something printed...

CHAPTER 3: DIGITAL IMAGING IN DIAGNOSTIC RADIOLOGY. 3.1 Basic Concepts of Digital Imaging

SketchUp Instructions

Intro to Excel spreadsheets

Solving Simultaneous Equations and Matrices

Vector storage and access; algorithms in GIS. This is lecture 6

Transcription:

1. Application of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe outline form. Multi-window environment is also favored for producing various zooming scales and views. Animations are useful for testing performance. Presentation Graphics To produce illustrations which summarize various kinds of data. Except 2D, 3D graphics are good tools for reporting more complex data. Computer Art Painting packages are available. With cordless, pressure-sensitive stylus, artists can produce electronic paintings which simulate different brush strokes, brush widths, and colors. Photorealistic techniques, morphing and animations are very useful in commercial art. For films, 24 frames per second are required. For video monitor, 30 frames per second are required. Entertainment Motion pictures, Music videos, and TV shows, Computer games Education and Training Training with computer-generated models of specialized systems such as the training of ship captains and aircraft pilots. Visualization For analyzing scientific, engineering, medical and business data or behavior. Converting data to visual form can help to understand mass volume of data very efficiently. Image Processing Image processing is to apply techniques to modify or interpret existing pictures. It is widely used in medical applications. Graphical User Interface Multiple window, icons, menus allow a computer setup to be utilized more efficiently. 2. Overview of Graphics Systems 2.1 Cathode-Ray Tubes (CRT) - still the most common video display device presently Electrostatic deflection of the electron beam in a CRT An electron gun emits a beam of electrons, which passes through focusing and deflection systems and hits on the phosphor-coated screen. The number of points displayed on a CRT is referred to as the 1

resolution (eg. 1024x768). Different phosphors emit small light spots of different colors, which can combine to form a range of colors. A common methodology for color CRT display is the Shadowmask method. Illustration of a shadow-mask CRT The light emitted by phosphor fades very rapidly, so it needs to redraw the picture repeatedly. There are 2 kinds of redrawing mechanisms: Raster-Scan and Random-Scan Raster-Scan The electron beam is swept across the screen one row at a time from top to bottom. As it moves across each row, the beam intensity is turned on and off to create a pattern of illuminated spots. This scanning process is called refreshing. Each complete scanning of a screen is normally called a frame. The refreshing rate, called the frame rate, is normally 60 to 80 frames per second, or described as 60 Hz to 80 Hz. Picture definition is stored in a memory area called the frame buffer. This frame buffer stores the intensity values for all the screen points. Each screen point is called a pixel (picture element). On black and white systems, the frame buffer storing the values of the pixels is called a bitmap. Each entry in the bitmap is a 1-bit data which determine the on (1) and off (0) of the intensity of the pixel. On color systems, the frame buffer storing the values of the pixels is called a pixmap (Though nowadays many graphics libraries name it as bitmap too). Each entry in the pixmap occupies a number of bits to represent the color of the pixel. For a true color display, the number of bits for each entry is 24 (8 bits per red/green/blue channel, each channel 2 8 =256 levels of intensity value, ie. 256 voltage settings for each of the red/green/blue electron guns). 2

Random-Scan (Vector Display) The CRT's electron beam is directed only to the parts of the screen where a picture is to be drawn. The picture definition is stored as a set of line-drawing commands in a refresh display file or a refresh buffer in memory. Random-scan generally have higher resolution than raster systems and can produce smooth line drawings, however it cannot display realistic shaded scenes. 2.2 Flat-Panel Displays - will be the most common video display device very soon. Reduced thickness, volumn, weight, and power requirements compared to CRT. Liquid-Crystal Displays (LCDs) - Liquid crystal refers to compounds which are in crystalline arrangement, but can flow like liquid. - The light source passes through a liquid-crystal material that can be aligned to either block or transmit the light. - 2 glass plates, each containing a light polarizer at right angles to the other, sandwich a liquid crystal material. - Rows of horizontal transparent conductors are built into one glass page. Columns of vertical conductors are put into the other plate. The intersection of 2 conductors defines a pixel position. - - Passive-matrix LCD - In the "on" state, polarized light passing through the material is twisted so that it will pass through the opposite polarizer. - Different materials can display different colors. - By placing thin-film transistors at pixel locations, voltage at each pixel can be controlled. -- Active-matrix LCD. 3

2.3. Graphics Systems Block diagram of a CRT graphics system In this context we discuss the graphics systems of raster-scan devices. A graphics processor accepts graphics commands from the CPU and executes the graphics commands which may involve drawing into the frame buffer. The frame buffer acts as a temporary store of the image and also as a decoupler to allow the graphics processor and the display controller to operate at different speeds. The display controller reads the frame buffer line by line and generates the control signals for the screen. Graphics commands: - Draw point - Draw polygon - Draw text - Clear frame buffer - Change drawing color 2 kinds of graphics processors: 2D graphics processors execute commands in 2D coordinates. When objects overlap, the one being drawn will obscure objects drawn previously in the region. BitBlt operations (Bit Block Transfer) are usually provided for moving/copying one rectangular region of frame buffer contents to another region. 3D graphics processors execute commands in 3D coordinates. When objects overlap, it is required to determine the visibility of the objects according to the z values. Display Controller for a raster display device reads the frame buffer and generates the control signals for the screen, ie. the signals for horizontal scanning and vertical scanning. Most display controllers include a colormap (or video look-up table). The major function of a colormap is to provide a mapping between the input pixel value to the output color. 2.4. Input Devices Common devices: keyboard, mouse, trackball and joystick Specialized devices: Data gloves are electronic gloves for detecting fingers' movement. In some applications, a sensor is also attached to the glove to detect the hand movement as a whole in 3D space. 4

A tablet contains a stylus and a drawing surface and it is mainly used for the input of drawings. A tablet is usually more accurate than a mouse, and is commonly used for large drawings. Scanners are used to convert drawings or pictures in hardcopy format into digital signal for computer processing. Touch panels allow displayed objects or screen positions to be selected with the touch of a finger. In these devices a touch-sensing mechanism is fitted over the video monitor screen. Touch input can be recorded using optical, electrical, or acoustical methods. 2.5 Hard-Copy Devices Directing pictures to a printer or plotter to produce hard-copy output on 35-mm slides, overhead transparencies, or plain paper. The quality of the pictures depend on dot size and number of dots per inch (DPI). Types of printers: line printers, laserjet, ink-jet, dot-matrix Laserjet printers use a laser beam to create a charge distribution on a rotating drum coated with a photoelectric material. Toner is applied to the drum and then transferred to the paper. To produce color outputs, the 3 color pigments (cyan, magenta, and yellow) are deposited on separate passes. Inkjet printers produce output by squirting ink in horizontal rows across a roll of paper wrapped on a drum. To produce color outputs, the 3 color pigments are shot simultaneously on a single pass along each print line on the paper. Inkjet or pen plotters are used to generate drafting layouts and other drawings of normally larger sizes. A pen plotter has one or more pens of different colors and widths mounted on a carriage which spans a sheet of paper. 2.6 Coordinate Representations in Graphics General graphics packages are designed to be used with Cartesian coordinate representations (x,y,z). Usually several different Cartesian reference frames are used to construct and display a scene: Modeling coordinates are used to construct individual object shapes. World coordinates are computed for specifying the placement of individual objects in appropriate positions. Normalized coordinates are converted from world coordinates, such that x,y values are ranged from 0 to 1. Device coordinates are the final locations on the output devices. 5

3. Output Primitives Shapes and colors of objects can be described internally with pixel arrays or sets of basic geometric structures such as straight line segments and polygon color areas. The functions provided by graphics programming packages to deal with these basic geometric structures are called output primitives. For example: Drawing a point: Drawing a line: SetPixel(100,200,RGB(255,255,0)); MoveTo(100,100); LineTo(100,200); Drawing some text: SetText(100,200,"Hello"); Drawing an ellipse: Ellipse(100,100,200,200); Painting a picture: BitBlt(100,100,50,50,srcImage,0,0,SRCCOPY); 3.1 Drawing a Thin Line in Raster Devices This is to compute intermediate discrete coordinates along the line path between 2 specified endpoint positions. The corresponding entry of these discrete coordinates in the frame buffer is then marked with the line color wanted. The basic concept is: - A line can be specified in the form: y = mx + c - Let m be between 0 to 1, then the slope of the line is between 0 and 45 degrees. - For the x-coordinate of the left end point of the line, compute the corresponding y value according to the line equation. Thus we get the left end point as (x1,y1), where y1 may not be an integer. - Calculate the distance of (x1,y1) from the center of the pixel immediately above it and call it D1 - Calculate the distance of (x1,y1) from the center of the pixel immediately below it and call it D2 - If D1 is smaller than D2, it means that the line is closer to the upper pixel than the lower pixel, then, we set the upper pixel to on; otherwise we set the lower pixel to on. - Then increatement x by 1 and repeat the same process until x reaches the right end point of the line. - This method assumes the width of the line to be zero 6

Bresenham's Line Algorithm This algorithm is very efficient since it use only incremental integer calculations. Instead of calculating the non-integral values of D1 and D2 for decision of pixel location, it computes a value, p, which is defined as: p = (D2-D1)* horizontal length of the line if p>0, it means D1 is smaller than D2, and we can determine the pixel location accordingly However, the computation of p is very easy: The initial value of p is 2 * vertical height of the line - horizontal length of the line. At succeeding x locations, if p has been smaller than 0, then, we increment p by 2 * vertical height of the line, otherwise we increment p by 2 * (vertical height of the line - horizontal length of the line) All the computations are on integers. The incremental method is applied to void BresenhamLine(int x1, int y1, int x2, int y2) { int x, y, p, const1, const2; /* initialize variables */ p=2*(y2-y1)-(x2-x1); const1=2*(y2-y1); const2=2*((y2-y1)-(x2-x1)); x=x1; y=y1; SetPixel(x,y); while (x<xend) { x++; if (p<0) { p=p+const1; else { y++; p=p+const2; SetPixel(x,y); 7

3.2 Drawing a Circle in Raster Devices A circle can be specified in the form: (x-x c ) 2 + (y-y c ) 2 = r 2 where (x c,y c ) is the center of the circle. To save time in drawing a circle, we can make use of the symmetrical property of a circle which is to draw the segment of the circle between 0 and 45 degrees and repeat the segment 8 times as shown in the diagram to produce a circle. Ths algorithm also employs the incremental method which further improves the efficiency. void PlotCirclePoints(int centerx, int centery, int x, int y) { SetPixel(centerx+x,centery+y); SetPixel(centerx-x,centery+y); SetPixel(centerx+x,centery-y); SetPixel(centerx-x,centery-y); SetPixel(centerx+y,centery+x); SetPixel(centerx-y,centery+x); SetPixel(centerx+y,centery-x); SetPixel(centerx-y,centery-x); void BresenhamCircle(int centerx, int centery, int radius) { int x=0; int y=radius; int p=3-2*radius; while (x<y) { PlotCirclePoints(centerx,centery,x,y); if (p<0) { p=p+4*x+6; else { p=p+4*(x-y)+10; y=y-1; x=x+1; PlotCirclePoints(centerx,centery,x,y); 8

3.3 Scan-Line Polygon Fill Algorithm - Basic idea: For each scan line crossing a polygon, this algorithm locates the intersection points of the scan line with the polygon edges. These intersection points are shorted from left to right. Then, we fill the pixels between each intersection pair. - Some scan-line intersection at polygon vertices require special handling. A scan line passing through a vertex as intersecting the polygon twice. In this case we may or may not add 2 points to the list of intersections, instead of adding 1 points. This decision depends on whether the 2 edges at both sides of the vertex are both above, both below, or one is above and one is below the scan line. Only for the case if both are above or both are below the scan line, then we will add 2 points. - Inside-Outside Tests: The above algorithm only works for standard polygon shapes. However, for the cases which the edges of the polygon intersects, we need to identify whether a point is an interior or exterior point. Students may find interesting descriptions of 2 methods to solve this problem in many text books: odd-even rule and nonzero winding number rule. 9

3.4 Boundary-Fill Algorithm - This algorithm starts at a point inside a region and paint the interior outward towards the boundary. - This is a simple method but not efficient: 1. It is recursive method which may occupy a large stack size in the main memory. void BoundaryFill(int x, int y, COLOR fill, COLOR boundary) { COLOR current; current=getpixel(x,y); if (current<>boundary) and (current<>fill) then { SetPixel(x,y,fill); BoundaryFill(x+1,y,fill,boundary); BoundaryFill(x-1,y,fill,boundary); BoundaryFill(x,y+1,fill,boundary); BoundaryFill(x,y-1,fill,boundary); - More efficient methods fill horizontal pixel spands across scan lines, instead of proceeding to neighboring points. 3.5 Flood-Fill Algorithm - Flood-Fill is similar to Boundary-Fill. The difference is that Flood-Fill is to fill an area which I not defined by a single boundary color. void BoundaryFill(int x, int y, COLOR fill, COLOR old_color) { if (GetPixel(x,y)== old_color) { SetPixel(x,y,fill); BoundaryFill(x+1,y,fill,boundary); BoundaryFill(x-1,y,fill,boundary); BoundaryFill(x,y+1,fill,boundary); BoundaryFill(x,y-1,fill,boundary); 10

3.6 Drawing Text - A character is defined by its outline which is usually comoposed of lines and curves. - We can use a method similar the one for rendering polygon to render a character - However, because text is used very oftenly, we usually convert them into bitmaps in advance to improve the drawing efficiency. - To draw a character on the screen, all we need to do is to copy the corresponding bitmap to the specified coordinate. - The problem with this method is that scaling a character with a bitmap to produce different character sizes would result in a block-like structures (stair-case, aliasing). Hence we normally render a few bitmaps for a single character to represent different sizes of the same character. 3.7 Bitmap - A graphics pattern suh as an icon or a character may be needed frequently, or may need to be reused. - Generating the pattern every time when needed may waste a lot of processing time. - A bitmap can be used to store a pattern and duplicate it to many places on the image or on the screen with simple copying operations. 11

3.8 Properties - In graphical output primitives, objects are normally associated with properties. Eg. Point: Line: Polygon: Text: color width, style, color edge color, filling color font size, color, bold or not bold, italic or not, underlined or not, etc. In graphical packages, we can specify such properties, eg. In Powerpoint, we can modify the properties of objects by a format command. In programming tools, we may pass the properties as arguments when we call the functions of these primitives, or we may pre-select the properties before calling the functions. 12