computer graphics unit i notes random scan systems line … · 2019-04-19 · s.no vector(random)...

27
1 | Page 1 Computer Graphics Unit I Notes Introduction, What is computer graphics? Elements of graphics workstation, Video Display Devices Raster Scan Systems, Random Scan Systems, Input Devices, Algorithms: Line drawing algorithms DDA Algorithm, Bresenham’s Line Algorithm, Frame Buffers. What is Computer graphics? The Computer graphics is one of the most effective and commonly used way to communicate the processed information to the user. It displays the information in the form of graphics objects such as pictures, charts, graphs and diagrams instead of simple text. In computer graphics, the data can be expressed in terms of pictorial form. The picture or graphics object may be an engineering drawing, business graphs, architectural structures, a single frame from an animated movie. Computer graphics is the use of computers to display and manipulate information in graphical or pictorial form, either on a visual-display unit or via a printer or plotter. 2D Computer graphics A picture that has height and width but no depth is two-dimensional (2-D). 2D computer graphics are the computer-based generation of digital images mostly from two- dimensional models, such as 2D geometric modes, text, and digital images, and by techniques specific to them. 2D computer graphics are mainly used in applications that were originally developed upon traditional printing and drawing technologies such as technical drawing, advertising etc. 3D Computer graphics A picture that has or appears to have height, width and depth is three dimensional (3-D) 3D graphics compared to 2D graphics are graphics that use a three-dimensional representation of geometric data. This includes images that may be for later display or for real-time viewing. 3D graphics are essential to realistic computer games, simulators and objects.

Upload: others

Post on 03-Aug-2020

14 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

1 | P a g e

1

Computer Graphics

Unit – I Notes

Introduction, What is computer graphics? Elements of graphics workstation, Video Display

Devices – Raster Scan Systems, Random Scan Systems, Input Devices, Algorithms: Line

drawing algorithms – DDA Algorithm, Bresenham’s Line Algorithm, Frame Buffers.

What is Computer graphics?

The Computer graphics is one of the most effective and commonly used way to communicate the

processed information to the user.

It displays the information in the form of graphics objects such as pictures, charts, graphs and

diagrams instead of simple text. In computer graphics, the data can be expressed in terms of

pictorial form.

The picture or graphics object may be an engineering drawing, business graphs, architectural

structures, a single frame from an animated movie.

Computer graphics is the use of computers to display and manipulate information in

graphical or pictorial form, either on a visual-display unit or via a printer or plotter.

2D Computer graphics

A picture that has height and width but no depth is two-dimensional (2-D).

2D computer graphics are the computer-based generation of digital images mostly from two-

dimensional models, such as 2D geometric modes, text, and digital images, and by techniques

specific to them.

2D computer graphics are mainly used in applications that were originally developed upon

traditional printing and drawing technologies such as technical drawing, advertising etc.

3D Computer graphics

A picture that has or appears to have height, width and depth is three dimensional (3-D)

3D graphics compared to 2D graphics are graphics that use a three-dimensional representation of

geometric data. This includes images that may be for later display or for real-time viewing.

3D graphics are essential to realistic computer games, simulators and objects.

Page 2: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

2 | P a g e

2

Computer Animation

Computer animation is the art of creating moving images via the use of computers. It is a created

by means of 3D computer graphics, though 2D computer graphics are still widely used for

stylistic, low bandwidth, and faster real-time rendering.

Concepts and principles

Image

An image or picture is an artifact, usually two-dimensional, that has a similar appearance to

some subject-usually a physical object or a person.

Digital Image

A digital image is a representation of a two dimensional image using ones and zeros(binary).

Depending on whether or not the image resolution is fixed, it may be of vector or raster type.

Pixel

In Computer graphics, pictures or graphics objects are presented as a collection of discrete

picture elements called pixels. Pixel is the smallest addressable screen element.

It is the smallest piece of the display which we can control. The control is achieved by setting the

intensity and colour of the pixel which compose the screen.

Rasterization

The process of determining the appropriate pixels for representing picture or graphics object is

known as rasterization.

Scan Conversion

The process of representing continuous picture or graphics object as a collection of discrete

pixels is called scan conversion.

Page 3: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

3 | P a g e

3

Classification of Computer Graphics

It can also classified according to Symbolic or Realistic

In Controllable interaction user can change the attributes of the images.

Computer graphics is either used for representation or it can be an end product such as

drawings.

Pictorial representation gives the final classification of use computer graphics. It

classifies the use of computer graphics to represent pictures such as line drawing, black

and white, colour and so on.

Application of Computer graphics

User Interfaces: The built in graphics provided with user interfaces use visual control items

such as buttons, menus, icons, scroll bar etc, which allows user to interact with computer

only by mouse click.

Plotting of Graphics and Chart: In industry, business, government and educational

organizations, computer graphics is most commonly used to create 2D and 3D graphs of

mathematical, physical and economic functions in form of histograms, bars and pie-charts.

Office Automation and Desktop publishing: The desktop publishing on personal

computers allow the use of graphics for the creation and dissemination of information

Computer Aided Drafting and Design: The Computer aided drafting uses graphics to

design components and systems electrical, mechanical, electro-mechanical and electronic

devices such as automobile bodies, structures of building , VLSI chips and computer

networks.

Page 4: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

4 | P a g e

4

Simulation and Animation: Use of graphics in simulation makes mathematic models and

mechanical systems more realistic and easy to study.

Cartography: Computer graphics is also used to represent geographic maps, weather maps,

oceanographic charts and so on.

Image Processing: In Computer graphics, a computer is used to create pictures. It applies

techniques to modify or interpret existing pictures such as photographs and scanned images.

Image processing techniques are most commonly used for picture enhancements to analyze

satellite photos, X-ray photography and so on.

Entertainment: Computer graphics is widely used in the production of movies, television

programs, books, games and magazines.

Overview of Graphics Systems

It consists of input and output devices, graphics system, application program and

application model.

A computer receives input from input devices and out images to display device.

The input and output devices are called the hardware components of the conceptual

framework.

There are three software components of conceptual framework.

o Application Model

o Application Program

o Graphics System

Application Model: The application model captures all the data and object to be pictured on the

screen.

Software Components Hardware Components

Page 5: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

5 | P a g e

5

Application Program: It creates the application model and communicates with it to receive and

store the data and information of the object’s attributes. The application program also handles

user input.

Graphics System: It is an intermediately between the application program and the display

hardware. It accepts the series of graphics output commands from application program.

Elements of Graphics Workstation

Graphics workstation is the graphics kernel system’s (GKS) term for a graphical device that

can display graphical output or accept graphical input or both.

It consists of Central Processing Unit(CPU), display processor, memory, display devices,

recorder, plotter, joy stick, keyboard, mouse, light pen, scanner etc.

The main hardware components of a graphics workstation are CPU and display processor.

The display processor is also called a graphics controller.

Page 6: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

6 | P a g e

6

It makes CPU free form the graphics chores. In addition to the system memory, a separate

display processor memory area is provided in graphics workstation.

Graphics workstations have a provision to interface video cameras and television set.

The size of the display device, colours supported by it, whether it is a raster or line drawing

device are the main properties of graphics workstation.

The workstation is connection to local area network for sharing files, accessing shared

peripherals and other high performance computers.

The graphics workstation is always supported with graphics software. Graphics software

acts as a very powerful tool to create scenes, images, pictures and also animated pictures.

Features of Graphics Workstation

They can be configured from 8 to 24 bits per pixel with higher screen resolutions, faster

processor and other option available in high-end systems.

They may have multiscreen system called the Media Wall, which provides a large wall-size

display area.

They have multiple input and output devices.

Video Display Devices

The display devices are also known as output devices. The most commonly used output device

in a graphics system is a video monitor.

The operation of most video monitors is based on the standard Cathode-Ray-Tube (CRT)

design.

Cathode Ray Tubes

A CRT is an evacuated glass tube. An electron gun at the rear of the tube produces a beam of

electrons which is directed towards the front of the tube by a high voltage typically 15000 to

20000 volts.

The inner side of the screen is coated with phosphor substance which gives off light when it is

storked by electrons.

Page 7: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

7 | P a g e

7

The Control grid voltage determines the velocity achieved by the electrons before hit the

phosphor. The control grid voltage determines how many electrons are actually in the electron

beam.

The Control grid controls the system concentrates the electron beam so that the beam converges

to a small point when it hits the phosphor coating.

The deflection system of the cathode ray tube consists of two pairs of Vertical deflection

plates, Horizontal deflection plates.

The voltage applied to vertical plates controls the vertical deflection of the electron beam and

voltage applied to the horizontal deflection plates controls the horizontal deflection of the

electron beam.

Two techniques used for producing images in CRT scree : Vector scan/random scan and

Raster scan.

Vector Scan/Random Scan Display

Vector scan CRT display directly traces out only the desired lines on CRT. If we want a line

connecting point A with point B on the vector graphics display.

If we want to move the beam from point A to point B without showing a line between points.

To move the beam across the CRT, the information about both, magnitude and direction is

required.

Page 8: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

8 | P a g e

8

A display controller is connected as an I/O peripheral to the Central Processing Unit (CPU).

The display buffer memory stores the computer produced display list or display program. The

program contains point and line plotting commands with (x,y) or (x,y,z).

In Vector displays beam is deflected from end point to end point, hence this technique is also

called random scan.

As display buffer is used to store display list and it is used for refreshing, the display buffer

memory is also called refresh buffer.

Raster Scan display

Raster scan is the most common method of displaying images on the CRT screen.

In this method, the horizontal and vertical deflection signals are generated to move the beam all

over the screen in a pattern.

Page 9: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

9 | P a g e

9

When the beam is moved from the left to the right it is ON. The beam is OFF, when it is moved

from the right to the left.

When the beam reaches the bottom of the screen, it is made OFF and rapidly retraced back to

the top left to start again. A display produced in this way is called raster scan display.

In raster scan display a special area of memory is dedicated to graphics only. This memory area

is called frame buffer. Each screen point is referred to as pixel or pel(picture element).

S.no Vector(Random) Scan Display Raster Scan Display

1 In vector scan display the beam is

moved between the end points of the

graphics primitives.

In raster scan display the beam is moved all

over the screen one scan line at a time, from top

to bottom and then back to top.

2 Scan conversion is not required Graphics primitives are specified in terms of

their endpoints and must be scan converted into

their corresponding pixels in the frame buffer.

3 Cost is more Cost is low

Page 10: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

10 | P a g e

10

Raster Scan Systems

Raster graphics systems consists of several components, which includes the CPU and special

purpose processor called video controller or display controller.

Raster Scan Display System with Video Controller

It consists of CPU, system memory, frame buffer, video controller and monitor.

The CPU and system memory work exactly in similar manner as in non-graphics computer

system. However, in raster scan displays a special area of memory is dedicated to graphics only.

This memory area is called Frame buffer.

The video controller retrieves the stores intensity values from frame buffer and displays them on

the screen one row (scan line) at a time, typically 50 times per second.

In 24-bit plane, 8-bits are used to represent each colour, and hence there are 8-bit planes per

colour. Each group of bit planes drives an 8-bit DAC. Each group generates 256 (28) shades or

intensities of red, green or blue. These are combined into 16,777,216 [(28)3 = 2

24] possible

colours. This is a full colour frame buffer.

The simple raster display system does not provide separate frame buffer. In that case it is stored

anywhere in the system memory and the video controller access the system memory via the

system bus.

Page 11: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

11 | P a g e

11

Video Controller

The internal organization of a video controller it consists of raster-scan generator, x and y

address registers, and pixel value register.

The raster-scan generator produces deflection signals that generate the raster scan.

The raster scan generator also controls the x and y address registers, which in turn define the

memory location to be accessed next.

During each fetch the pixel value is read and is used to control the intensity of the CRT beam.

In colour displays, 24-bits per pixel are commonly used, where 8-bits represents 256 levels for

each colour. It is necessary to read 24-bits for each pixel from frame buffer.

To avoid this video controller uses look-up-table (LUT) to store many entities of pixel values in

RGB format.

The look-up table has 256 entries, the index to the look-up table has 8-bits and hence for each

pixel frame buffer has to store 8-bits per pixel instead of 24-bits.

Page 12: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

12 | P a g e

12

The output from the video controller has one of three forms: RGB, Monochrome

For RGB(Red, Green and Blue) separate cables carry the red, green, and blue signals to CRT

and another cable carries the synchronization signals.

Video controller provides the facility of video mixing. In which it accepts information

simultaneously. One from frame buffer and the other from television camera, recorder and other

source.

The video controller merges the two received images to form a composite image.

Refreshing

For refreshing a 1280 by 1024 screen with 32-bit (one word) pixels at 50 Hz requires that

memory accesses occur every 1/(1280 x 1024 x 50) = 15.26 nano seconds.

It indicates that something must be done to increase the bandwidth to frame buffer memory.

Random Scan System

The architecture of a random scan display system with display processor. This architecture is

similar to the display processor based raster system architecture except the frame buffer.

In random scan display no local memory is provides for scan conversion algorithms, since that

functionality is typically implemented using PLAs (Programmable Logic Arrays) or microcode.

Page 13: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

13 | P a g e

13

In random scan displays, the display processor has its own instruction set and instruction

address register. Hence it is also called Display Processing Unit or Graphics controller.

It performs instruction fetch, decode and execute cycles found in any computer.

The program executed by the display processor and graphics package reside in the main

memory.

The main memory is shared by the general CPU and the display processor.

Input devices

The interactive devices are the devices which gives input to the graphics system and provides

necessary feedback to the user about the accepted input.

Keyboard

The Keyboard is a primary input device.

It includes different keys and each key sends a different signal to the CPU.

Most of the keys are useful for entering text and numbers.

A standard keyboard includes about 100 keys.

When you press any key on the keyboard, the sequential steps are carried out inside the

computer due to which the CPU understands, which key is pressed.

Keyboard Keyboard Controller Keyboard buffer System Software CPU

Mouse

Now a days, every new PC includes an additional input pointing device called ‘mouse’. By

moving this device around a flat surface, we can control the mouse pointer

The mouse pointer moves in relation to the mouse’s movements it can be used to:

Page 14: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

14 | P a g e

14

Select text

Access menu

Interact with programs, files or data that appear on the screen

The pointing process is combined with different techniques to use the mouse for performing

various operations. The techniques are,

Clicking

Double-clicking

Dragging

Right-clicking

Trackball

A trackball works like an upside-down mouse as a pointing device.

A trackball contains an exposed ball that can be rolled with an index finger or thumb to

move the pointer around the screen.

A trackball needs less space than a mouse as it is not necessary to move the whole device.

Trackpads

The trackpad is also called a ‘touchpad’. It is a stationary pointing device.

There are two types of trackpads,

1. Buttons trackpads: they include two or three buttons that perform the same functions as

mouse buttons.

2. Strike sensitive trackpads: They use pads which can be tapped with fingertip.

Touch Screens

When you place a fingertip directly on the computer screen, touch-screen accepts input.

Page 15: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

15 | P a g e

15

In most touch-screen computers the sensors are used on the screen’s surface to detect the touch

of a finger.

The applications are used in touch screens,

Automated teller machines

Public information kiosks

Entertainment (theatres)

Supermarkets

Joystick

A joystick is a personal computer input device consists of a handheld stick that pivots about one

end transmits its angle in two or three dimensions to a computer.

It has a small, vertical lever called the stick mounted on the base and used to steer the screen

cursor around.

Light pen

A Light pen is a pointing device shaped like a pen acts as computer input device.

The tip of the light pen contains a light-sensitive element which, when placed against the screen,

detects the light from the screen enabling the computer to identify the location of the pen on the

screen.

Page 16: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

16 | P a g e

16

Light pens have the advantage of ‘drawing’ directly onto the screen.

A Light pen can work with any CRT-based monitor, but not with LCD screens, projectors or

other display devices.

Data Glove

The data glove is used to grasp a virtual object. It is constructed with a series of sensors that

detect hand and finger motions.

Each sensor is a short length of fiber optic cable, with a Light-Emitting Diode (LED) at one end

and a phototransistor at the other end.

By wearing the dataglove, a user can grasp, move and rotate objects and then release them.

Scanners

The scanners is a device which can be used to store drawing, graphs, photos or text available in

printed form for computer processing.

The scanners use the optical scanning mechanism to scan the information.

The scanners records the gradation of gray scales or colour and stores them in the array. It stores

the image information in a specific file format such as JPEG, GIF, TIFF, BMP, PDF and so on.

We can apply transformation to rotate, scale or crop the images.

Page 17: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between

17 | P a g e

17

Frame Buffers

Last stage in the implementation procedures for line segments and other objects is to set the

frame-buffer color values. Since scan-conversion algorithms generate pixel positions at

successive unit intervals, incremental operations can be used to load the frame buffer efficiently

at each step of the scan-conversion process.

Display screen is shown with pixel positions (x,y) are labeled from (0,0) at the lower-left screen

corner to (xmax, ymax) at the top-right corner and the frame buffer is represented as an array. It

stores pixel values row by row from bottom to top and from left to right.

For eg:

If frame buffer size is 8 x 8 and frame buffer address for pixel (0,0) = 0

Then the frame buffer address for pixel (3,4) is 0+4(7+1) +3 = 35.

For moving across a scan line, the frame-buffer address for the pixel at (x+1,y) in terms of frame

buffer address for the pixel at (x,y) is given as

addr(x+1,y) = addr(x,y) + 1

Page 18: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between
Page 19: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between
Page 20: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between
Page 21: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between
Page 22: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between
Page 23: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between
Page 24: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between
Page 25: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between
Page 26: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between
Page 27: Computer Graphics Unit I Notes Random Scan Systems Line … · 2019-04-19 · S.no Vector(Random) Scan Display Raster Scan Display 1 In vector scan display the beam is moved between