




































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





































































Computer Graphics is a field related to the generation of graphics using computers. It includes the creation, storage, and manipulation of images of objects. These objects come from diverse fields such as physical, mathematical, engineering, architectural, abstract structures and natural phenomenon. Computer graphics today is largely interactive, that is , the user controls the contents, structure, and appearance of images of the objects by using input devices, such as keyboard, mouse, or touch- sensitive panel on the screen.
Until the early 1980's computer graphics was a small, specialized field, largely because the hardware was expensive and graphics-based application programs that were easy to use and cost-effective were few. Then personal computers with built-in raster graphics displays-such as the Xerox Star, Apple Macintosh and the IBM PC- popularized the use of bitmap graphics for user-computer interaction. A bitmap is a ones and zeros representation of the rectangular array points on the screen. Each point is called a pixel, short for "Picture Elements". Once bitmap graphics became affordable, and explosion of easy-to-use and inexpensive graphics-based applications soon followed. Graphics-based user interfaces allowed millions of new users to control simple, low-cost application programs, such as word-processors, spreadsheets, and drawing programs.
The concepts of a "desktop" now became a popular for organizing screen space. By means of a window manager, the user could create, position and resize rectangular screen areas called windows. This allowed user to switch among multiple activities just by pointing and clicking at the desired window, typically with a mouse. Besides windows, icons which represent data files, application program, file cabinets, mailboxes, printers, recycle bin, and so on, made the user-computer interaction more effective. By pointing and clicking the icons, users could activate the corresponding programs or objects, which replaced much of the typing of the commands used in earlier operating systems and computer applications.
Today, almost all interactive application programs, even those for manipulating text(e.g.. word processor) or numerical data (e.g. spreadsheet programs), use graphics extensively in the user interface and for visualizing and manipulating the application-specific objects.
Even people who do not use computers encounter computer graphics in TV commercials and as cinematic special effects. Thus computer graphics is and integral part of all computer user interfaces, and is indispensable for visualizing 2D, 3D objects in all most all areas such as education, science, engineering, medicine, commerce, the military, advertising, and entertainment. The theme is that learning how to program and use computers now includes learning how to use simple 2D graphics.
We need to take a brief look at the historical development of computer graphics to place today's system in context. Crude plotting of hardcopy devices such as teletypes and line printers dates from the early days of computing. The Whirlwind Computer developed in 1950 at the Massachusetts Institute of Technology(MIT) had computer-driven CRT displays for output. The SAGE air-defense system developed in the middle 1950s was the first to use command and control CRT display consoles on which operators identified targets with light pens(hand-held pointing devices that sense light emitted by objects on the screen). Later on Sketchpad system by Ivan Sutherland came in light. That was the beginning of modern interactive graphics. In this system, keyboard and light pen were used for pointing, making choices and drawing.
At the same time, it was becoming clear to computer, automobile, and aerospace manufacturers that CAD and computer-aided manufacturing(CAM) activities had enormous potential for automating drafting and other drawing-intensive activities. The General Motors CAD system for automobile design , and the Itek Digitek system for lens design, were pioneering efforts that showed the utility of graphical interaction in the iterative design cycles common in engineering. By the mid-60s , a number of commercial products using these systems had appeared.
At that time only the most technology-intensive organizations could use the interactive computer graphics whereas other used punch cards, a non-interactive system. Among the reasons for this were these:
ļ· The high cost of the graphics hardware-at a time when automobiles cost a few thousand dollors, computers cost several millions of dollors, and the first computer displays cost more that a hundred thousand dollors.
ļ· The need for large-scale, expensive computing resources to support massive design database.
ļ· The difficulty of writhing large, interactive programs using batch-oriented FORTRAN programming.
ļ· One of a kind , non portable software, typically written for a particular manufacturer's display devices. When software is non-portable, moving to new display devices necessitates expensive and time-consuming rewriting of working programs.
This interactive computer graphics had a limited use when it started in the early sixties. But became very common once the Apple Macintosh and IBM PC appeared in the market with affordable cost.
and electronic(softcopy) documents that contain text, tables, graphs, and other forms of drawn or scanned-in graphics.
One of the major uses of computer graphics is to design components and systems of mechanical, electrical, electrochemical, and electronic devices, including structures such as buildings, automobile bodies, airplane and ship hulls, very large scale integrated (VLSI) chips, optical systems,. and telephone and computer networks. These designs are more frequently used to test the structural, electrical, and thermal properties of the systems.
Generating computer graphics for scientific, engineering, and medical data sets is termed as scientific visualization whereas business visualization is related with the non scientific data sets such as those obtained in economics. Visualization makes easier to understand the trends and patterns inherent in the huge amount of data sets. It would , otherwise , be almost impossible to analyze those data numerically.
Simulation is the imitation of the conditions like those , which is encountered in real life. Simulation thus helps to learn or to feel the conditions one might have to face in near future without being in danger at the beginning of the course. For example, astronauts can exercise the feeling of weightlessness in a simulator; similarly a pilot training can be conducted in flight simulator. The military tank simulator, the naval simulator, driving simulator, air traffic control simulator, heavy-duty vehicle simulator, and so on are some of the mostly used simulator in practice. Simulators are also used to optimize the system, for example the vehicle, observing the reactions of the driver during the operation of the simulator.
Disney movies such as Lion Kings and The Beauty of Beast, and other scientific movies like Jurassic Park, The lost world etc are the best example of the application of computer graphics in the field of entertainment. Instead of drawing all necessary frames with slightly changing scenes for the production of cartoon- film, only the key frames are sufficient for such cartoon-film where the in between frames are interpolated by the graphics system dramatically decreasing the cost of production while maintaining the quality. Computer and video games such FIFA, Doom ,Pools are few to name where graphics is used extensively.
Here computer graphics is used to produce pictures that express a message and attract attention such as a new model of a car moving along the ring of the Saturn. These pictures are frequently seen at transportation terminals supermarkets , hotels etc. The slide production for commercial , scientific, or educational presentations is another cost effective use of computer graphics. One of such graphics packages is a PowerPoint.
Cartography is a subject , which deals with the making of maps and charts. Computer graphics is used to produce both accurate and schematic representations of geographical and other natural phenomena from measurement data. Examples include geographic maps , oceanographic charts, weather maps, contour maps and population-density maps. Surfer is one of such graphics packages , which is extensively used for cartography.
objects on CRT because it can be curved to the shape of the CRT. The mechanism used in the electrical or sonic tablets can also be used to digitize the 3D objects.
2. Touch panel
The touch panel allows the users to point at the screen directly with a finger to move the cursor around the screen, or to select the icons. Following are the mostly used touch panels.
a. Optical touch panel
It uses a series of infra-red light emitting diodes (LED) along one vertical edge and along one horizontal edge of the panel. The opposite vertical and horizontal edges contain photo-detectors to form a grid of invisible infrared light beams over the display area. Touching the screen breaks one or two vertical and horizontal light beams, thereby indicating the finger's position. The cursor is then moved to this position, or the icon at this position is selected. It two parallel beams are broken, the finger is presumed to be centered between them; if one is broken, the finger is presumed to be on the beam. There is a low-resolution panel, which offers 10 to 50 positions in each direction.
b. Sonic panel:
Bursts of high-frequency sound waves traveling alternately horizontally and vertically are generated at the edge of the panel. Touching the screen causes part of each wave to be reflected back to its source. The screen position at the point of contact is then calculated using the time elapsed between when the wave is emitted and when it arrives back at the source. This is a high-resolution touch panel having about 500 positions in each direction.
c. Electrical touch panel:
It consists of slightly separated two transparent plates one coated with a thin layer of conducting material and the other with resistive material. When the panel is touched with a finger, the two plates are forced to touch at the point of contact thereby creating the touched position. The resolution of this touch panel is similar to that of sonic touch panel.
3. Light pen
It is a pencil-shaped device to determine the coordinates of a point on the screen where it is activated such as pressing the button. In raster display, Y is set at Ymax and X changes from 0 to Xmax for the first scanning line. For second line, Y decreases by one and X again changes from 0 to Xmax, and so on. When the activated light pen "sees" a burst of light at certain position as the electron beam hits the phosphor coating at that position, it generates a electric pulse, which is used to save the video controller's X and Y registers and interrupt the computer. By reading the saved values, the graphics package can determine the coordinates of the position seen by the light pen. Because of the following drawbacks the light pens are not popular now a days. ļ· Light pen obscures the screen image as it is pointed to the required spot
ļ· Prolong use of it can cause arm fatigue ļ· It can not report the coordinates of a point that is completely black. As a remedy one can display a dark blue field in place of the regular image for a single frame time ļ· It gives sometimes false reading due to background lighting in a room
4. Keyboard
A keyboard creates a code such as ASCII uniquely corresponding to a pressed key. It usually consists of alphanumeric keys, function keys, cursor-control keys, and separate numeric pad. It is used to move the cursor, to select he menu item, pre- defined functions. In computer graphics keyboard is mainly used for entering screen coordinates and text, to invoke certain functions. Now-a-days ergonomically designed keyboard (Ergonomic keyboard) with removable palm rests is available. The slope of each half of the keyboard can be adjusted separately.
5. Mouse
A mouse is a small hand-held device used to position the cursor on the screen. Mice are relative devices, that is, they can be picked up, moved in space, and then put down gain without any change in the reported position. For this, the computer maintains the current mouse position, which is incremented or decremented by the mouse movements. Following are the mice, which are mostly used in computer graphics.
a. Mechanical mouse When a roller in the base of this mechanical mouse is moved, a pair of orthogonally arranged toothed wheels, each placed in between a LED and a photo detector, interrupts the light path. the number of interrupts so generated are used to report the mouse movements to the computer.
b. Optical mouse The optical mouse is used on a special pad having a grid of alternating light and dark lines. A LED on the bottom of the mouse directs a beam of light down onto the pad, from which it is reflected and sensed by the detectors on the bottom of the mouse. As the mouse is moved, the reflected light beam is broken each time a dark line is crossed. The number of pulses so generated, which is equal to the number of lines crossed, are used to report mouse movements to the computer.
The display devices used in graphics system is video monitor. The most common video monitor is based on CRT technology.
Cathode Ray Tube (CRT) ā CRT are the most common display devices on computer today. A CRT is an evacuated glass tube, with a heating element on one end and a phosphor-coated screen on the other end.
Persistence: ā How long a phosphor continues to emit light after the electron beam is removed ā Persistence of phosphor is defined as the time it takes for emitted light to decay to 1/10 (10%) of its original intensity. Range of persistence of different phosphors can react many seconds. ā Phosphors for graphical display have persistence of 10 to 60 microseconds. Phosphors with low persistence are useful for animation whereas high persistence phosphor is useful for highly complex, static pictures.
Refresh Rate: ā Light emitted by phosphor fades very rapidly, so to keep the drawn picture glowing constantly, it is required to redraw the picture repeatedly and quickly directing the electron beam back over the some point. The no of times/sec the image is redrawn to give a feeling of non-flickering pictures is called refresh-rate. ā If Refresh rate decreases, flicker develops. ā For refresh displays, it depends on picture complexity
ā Refresh rate above which flickering stops and steady it may be called as critical fusion frequency(CFF).
Resolution: Maximum number of points displayed horizontally and vertically without overlap on a display screen is called resolution. In other ways , resolution is referred as the no of points per inch(dpi/pixel per inch).
Raster-Scan Display
ā Raster Scan Display is based on television technology. In raster-scan the electron beam is swept across the screen, one row at a time from top to bottom. No of scan line per second is called horizontal scan rate. ā As electron beam moves across each row, the beam intensity is turned on and off to create a pattern of illuminated spots. Picture definition is stored in a memory called frame buffer or refresh buffer. Frame buffer holds all the intensity value for screen points.
Figure: A raster-scan system displays an object as a set of points across each screen scan line
Figure: Raster Scan display system
ā The stored intensity value is retrieved from frame buffer and painted on the scan line at a time. Home television are common examples using raster display ā Intensity range for pixel position depends on capability of raster system. For B/W system each point on screen are either on or off, so only one bit per pixel is needed to control the pixel intensity. To display color with varying intensity level, additional bits are needed. Up to 24 to 32 bit per pixel are included in high quality systems, which require more space of storage for the frame buffer, depending upon the resolution of the system. ā A system with 24 bit pixel and screen resolution 1024 ļ“1024 require 3 megabyte of storage in frame buffer. 10241024 pixel = 10241024*24 bits = 3 MB
Frame Buffer
1. Indexed-color frame buffer. In indexed ā color frame buffer, ā Each pixel uses one byte in frame buffer. ā Each byte is an index into a color map. ā Each pixel may be one of 3^24 colors, but only 256 color can be displayed at a time.
ā There is a look-up table which has as many entries as there are pixel values. ā The table entry value is used to control the intensity or color of the CRT.
Figure: Indexed color frame buffer
D/A
D/A
D/A
Color map or lookup Frame Buffer table
Display
Figure : True Color Frame Buffer
3 High-color frame buffer ļ· Popular PC/SVGA standard ļ· Pixels are packed in a short i.e. each primary color use 5 bit. ļ· Each pixel can be one of 2^15 colors
In random scan system, the CRT has the electron beam that is directed only to the parts of the screen where the picture is to be drawn. It draws a picture one line at a time, so it is also called vector display (or stroke writing or calligraphic display). The component lines of a picture are drawn and refreshed by random scan system in any specified order.
Figure: Random Scan Display
Red Green Blue
(a) (b)
(c) (d)
D/A
D/A
D/A
Frame Buffer
Display
Mux Mux^ Mux
ā In color CRT, the neck of tube, there are three electron guns, one for each red, green and blue colors. In phosphor coating there may be either strips one for each primary color, for a single pixel or there may be three dots one for each pixel in delta fashion. ā Special metal plate called a shadow mask is placed just behind the phosphor coating to cover front face. ā The mask is aligned so that it simultaneously allow each electron beam to see only the phosphor of its assigned color and block the phosphor of other two color.
Depending on the pattern of coating of phosphor, two types of raster scan color CRT are commonly used using shadow mask method.
ā In delta-delta CRT, three electron beams one for each R,G,B colors are deflected and focused as a group onto shadow mask, which contains a series of holes aligned with the phosphor dots. ā
Figure: Shadow mask in Delta-Delta CRT
ā Inner side of viewing has several groups of closely spaced red ,green and blue phosphor dot called triad in delta fashion. ā Thin metal plate adjusted with many holes near to inner surface called shadow mask which is mounted in such a way that each hole aligned with respective triad.
ā Triad are so small that is perceived as a mixture of colors. When three beams pass through a hole in shadow mask, they activate the dot triangle to illuminate an small spot colored on the screen.
ā The color variation in shadow mask CRT can be obtained by varying the intensity level of the three electron guns.
The main draw back of this CRT is due to difficulty for the alignment of shadow mask hole and respective triads.
Shadow Mask
Screen
Electron Gun
This CRT uses strips pattern instead of delta pattern. Three strips one for each R, G, B color are used for a single pixel along a scan line so called inline. This eliminates the drawbacks of delta-delta CRT at the cost of slight reduction of image sharpness at the edge of the tube.
ā Normally 1000 scan lines are displayed in this method. Three beams simultaneously expose three inline phosphor dots along scan line.
Architecture of Raster Scan System:
The raster graphics systems typically consists of several processing units. CPU is the main processing unit of computer systems. Besides CPU, graphics system consists of a special purpose processor called video controller or display processor. The display processor controls the operation of the display device.
The organization of raster system is as shown below
Figure: A simple Raster System.
ļ· A fixed area of system memory is reserved for the frame buffer. The video controller has the direct access to the frame buffer for refreshing the screen. ļ· The video controller cycles through the frame buffer, one scan line at a time, typically at 60 times per second or higher. The contents of frame buffer are used to control the CRT beam's intensity or color.
The video controller: The video controller is organized as in figure below. The raster-scan generator produces deflection signals that generate the raster scan and also controls the X and Y address registers, which in turn defines memory location to be accessed next. Assume
System Frame Memory buffer
Peripheral device
Video controller
Monitor
System Bus
Figure : Architecture of Vector Display System
ā Vector display system consists of several units along with peripheral devices. The display processor is also called as graphics controller. ā Graphics package creates a display list and stores in systems memory (consists of points and line drawing commands) called display list or display file. ā Refresh time around so cycle per second. ā Vector display technology is used in monochromatic or beam penetration color CRT. ā Graphics are drawn on a vector display system by directing the electron beam along component line.
Advantages: ļ· Can produce output with high resolutions. ļ· Better for animation than raster system since only end point information is needed.
Disadvantages: ļ· Cannot fill area with pattern and manipulate bits. ļ· Refreshing image depends upon its complexity.
System Memory
Peripheral device
Display processor
System Bus
Monitor
Move (10,10) Move (512,512)
Line (ā¦..)
Line (ā¦..)
Display file
Chapter 3: 2D Algorithms
Line Drawing Algorithms. The slope-intercept equation of a straight line is: y ļ½ mx ļ« b where m = slope of line and , b = y-intercept.
for any two given points ( x 1 , y 1 )and( x 2 , y 2 )
slope (m) = 2 1
2 1 x x
y y ļ
ļ b ļ½ y ļ x x x
y y 2 1
2 1 ļ
from above equation i.e. y ļ½ mx ļ« b
At any point( xk , yk )
y (^) k ļ½ mxk ļ« b ā¦ā¦ā¦ā¦ā¦. 1
At ( xk ļ« 1 , yk ļ« 1 ),
y (^) k ļ« 1 ļ½ mxk ļ« 1 ļ« b ā¦ā¦ā¦ā¦ā¦2.
subtracting 1 from 2 we get- yk (^) ļ« 1 ļ yk ļ½ m ( xk ļ« 1 ļ xk )
Here ( yk (^) ļ« 1 ļ yk ) is increment in y as corresponding increment in x.
ļ ļ y ļ½ m .ļ x
or x
y m ļ
For incremental algorithm in line drawing , ļ· Increment x by 1 ļ· Computer corresponding y and display pixel at position (xi, round (yi) )
Problem: Floating point multiplication & addition ļ· The round function.
DDA line Algorithm:
The digital differential analyzer (DDA) is a scan conversion line drawing algorithm based on calculating either ļ x or ļ y form the equation,
ļ y ļ½ m. ļ x.
We sample the line at unit intervals in one co-ordinate and determine the corresponding integer values nearest to the line path for the other co-ordinates. Consider a line with positive slope. If m<=1, we sample x co-ordinate. So ļ x ļ½ 1 and compute each successive y value as:
y (^) k ļ« 1 ļ½ yk ļ« m , ļ ļ½ 1 ļ
ļ½ x x
y ļ m y 1
y 2
x 1 m<=
x 2