Sei sulla pagina 1di 503

DTEIT 19/8/

CG-6284

DTEIT 19/8/99

CG-6284

DTEIT 19/8/

CG-6284

THREE YEAR DIPLOMA PROGRAM IN


COMPUTER ENGINEERING

COMPUTER GRAPHICS
CODE : 6284
THIRD YEAR ( SESSION 1999 - 2000 )

Number of Slides

: 1000

Two floppies include 1000 Slides.

DTEIT 19/8/

CG-6284

Features of Computer Graphics


Computer graphics is one of the most exciting
and rapidly growing field in computer
science. Some

of the most sophisticated

computer system in use today are designed


for the generation of graphics displays.

DTEIT 19/8/

CG-6284

Features of Computer Graphics


We all know the value of a picture as an
effective means for communication and the
ability to converse pictorially with a computer
is revolutionizing the way computers are
being used in all areas.
Computers have become a powerful tool
DTEIT 19/8/

CG-6284

You may Learn


For the rapid and economical production of pictures. There
is virtually no area in which graphics displays cannot be
used to some advantage and so it is not surprising to find
the me of computer graphics 30 widesprect.
Although early applications in engineering and science

DTEIT 19/8/

CG-6284

You may Learn


Had to rely on expensive and comber some
equipments ,advances in computer
technology hare made interactive computer
graphics a practical tool. Today, we find
computer graphics used routinely in such
diverse areas as business , research ,
training and medicine.
DTEIT 19/8/

CG-6284

Teaching Scheme
Total Number of Lectures 3 per Week
Practical 3 per Week

3+3=6

Theory 15 credits and 10 marks for Practical .


Total No. of credits are 15+10=25(Internal Assessment )

75 +25 =100 (External Assessment)


DTEIT 19/8/

CG-6284

DTEIT 19/8/

CG-6284

10

GRAPHIC SYSTEMS
Display devices
Physical input and output devices
Display

processors

graphics

software

coordinate representation,
Graphics functions and standards.
DTEIT 19/8/

CG-6284

11

OUTPUT PRIMITIVES
Point plotting
Line drawing algorithms-DDA algorithms
Bresenhams line algorithms
Circle generating algorithms
Ellipses
Attributes and construction techniques
DTEIT 19/8/

CG-6284

12

TWO-DIMENSIONAL
TRANSFORMATIONS
Basic
transformationstranslation,scaling,rotation,matrix
representations
and
homogeneous
coordinates
Composite transformations- scaling relative to
a fixed pivot,rotation about a pivot
point,general transformation equation,other
transformation
Reflection.
DTEIT 19/8/

CG-6284

13

WINDOWING AND
CLIPPING TECHNIQUES
Windowing concepts
Clipping algorithms
Area clipping
Line clipping
DTEIT 19/8/

CG-6284

14

WINDOWING AND
CLIPPING TECHNIQUES
Polygon clippings
Text clippings
Blanking
Window-to-view point transformations,
Cohen sutherland clipping algorithm.

DTEIT 19/8/

CG-6284

15

ANIMATION TECHNIQUES
Animation perspectives
Computer animation hardware
Computer animation software and
applications
PC animations,concept of simulations.

DTEIT 19/8/

CG-6284

16

PROJECTION
Perspective and parallel transformation
Vanishing points
Perspective

DTEIT 19/8/

anomalies

CG-6284

17

LABORATORY WORK
Line drawing
DDA
Bresenhams circle generation
Two-dimensional transformation
Computer animation
DTEIT 19/8/

CG-6284

18

LABORATORY WORK
Windowing and clipping
Projection of a cube or any other three
dimensional figure using parallel and
perspective transformation.

DTEIT 19/8/

CG-6284

19

Evaluation Scheme
Study Scheme
HRS/Week Internal Assessment
Th Pr
3

Tot
6

Th
15

Pr
10

Tot
25

External Assessment

Marks

Th Hrs Pr Hrs Tot


75
3
100
25 3

Ext.Int
125

Minimum Passing Marks 30 out of 75


Minimum Passing Marks 10 out of 25
DTEIT 19/8/

CG-6284

20

Style of Examination
Theory Paper
Total Marks (75 Th) Duration (3 Hrs)
Passing Marks 30
Multiple Choice, True False, Fill in the
blanks, Short Answer Type and Descriptive
Answer Questions.
You have to attempt 5 out of 8.
DTEIT 19/8/

CG-6284

21

Style of Examination
Practical
Total Marks 25
Passing Marks 10

Duration 3 Hrs

Practical performance, Viva, Theory test


and working File on the bases of mentioned
above student may get marks.

DTEIT 19/8/

CG-6284

22

List of Practical
(1). Write a program to draw a line using simple
method .
(2). Write a program to draw a line using DDA
algorithm in C.
(3). Write a program to draw a line using
BRESENHAMs algorithm in C.
(4). Draw the triangle using DDA line draw
algorithm.
DTEIT 19/8/

CG-6284

23

List of Practical
(5).Draw the rectangle using DDA line draw
algorithm.
(6).Write a program to draw a circle using
midpoint circle generation algorithm.
(7).Write a program to draw a ellipse using
midpoint circle generation algorithm.
(8).Write a program to translate a point.
DTEIT 19/8/

CG-6284

24

List of Practical
(9). Write a program to translate scale and rotate
a line.
(10). Write a program to translate scale and
rotate a triangle.
(11). Write a program for motion of a man with
animation effects in C language.
(12). Write a program for windowing and
clipping of line, polygon.
DTEIT 19/8/

CG-6284

25

BOOKS AND REFERENCES


1.Principles Of interactive computer graphics
by WM NEWMAN and RF SPRAULL.
2.Theory And problems Of
computer
graphics by ROY A PLASTOCK and
GORDON
KALLEY,
McGraw-HILL
PUBLISHERS , SCHAUMS AUTHINE
SERIES.
3.Interactive
computer
graphics
by
HARENGTON.

DTEIT 19/8/

CG-6284

26

BOOKS AND REFERENCES


4.Computer graphics programming approach by
STEVEN HARRINGTON.
5.Computer graphics by DONALD HEARN AND M
PAULINE BAKER.

DTEIT 19/8/

CG-6284

27

DTEIT 19/8/

CG-6284

28

INTRODUCTION

Computers have become a


powerful tool for the

RAPID AND

ECONOMICAL PRODUCTION

of pictures.
There is virtually no area in which graphical
displays cannot be used to some advantage.

DTEIT 19/8/

CG-6284

29

INTRODUCTION

Although early applications in engineering and


science had to
relay on

EXPENSIVE AND

CUMBERSOME EQUIPMENT

Advances in computer technology have made


interactive computer graphics a practical tool

DTEIT 19/8/

CG-6284

30

INTRODUCTION
Computer graphics today is largely
interactive:
the user controls

#
CONTENTS
# STRUCTURE &
# APPEARANCE OF OBJECTS

The use of bitmap graphics is for user


computer interaction.

DTEIT 19/8/

CG-6284

31

INTRODUCTION

Bitmap is a ones & zeros


representation of the rectangular array of
points i.e.

PIXELS OR

PELS OR

PICTURE ELEMENTS

DTEIT 19/8/

CG-6284

32

INTRODUCTION

Images of objects are displayed by using


input devices such as :

KEYBOARD

MOUSE OR

TOUCH-SENSITIVE PANEL

on the screen.

The user could

CREATE

DTEIT 19/8/

CG-6284

33

INTRODUCTION

POSITION AND

RESIZE

Rectangular screen areas

That acted as :
#

called windows.

VIRTUAL GRAPHICS TERMINALS &

# EACH TERMINAL RUNNING AN


APPLICATION.

DTEIT 19/8/

CG-6284

34

INTRODUCTION

Direct manipulation of objects via :

POINTING &

CLICKING

Replaced much of the typing of the arcane


commands used in earlier operating
systems and computer applications.

DTEIT 19/8/

CG-6284

35

INTRODUCTION

Computer graphics is no longer a rarity.

Computer graphics is an integral part of


all coputer user interfaces, and is
indispensable for visualizing

2-D,

3-D AND
HIGHER DIMENSIONAL OBJECTS.

DTEIT 19/8/

CG-6284

36

COMPUTER GRAPHICS
APPLICATIONS

COMPUTER AIDED DESIGN


COMPUTER ART
ENTERTAINMENT
EDUCATION AND TRAINING
VISUALIZATION
IMAGE PROCESSING
GRAPHICAL USER INTERFACES
PROCESS CONTROL
CARTOGRAPHY

DTEIT 19/8/

CG-6284

37

COMPUTER AIDED DESIGN


Computer aided design methods are now

routinely used in the design of :

BUILDINGS,
AUTO-MOBILES,
AIRCRAFT,
WATRECRAFT,
SPACECRAFT,
TEXTILES and many other

DTEIT 19/8/

CG-6284

products.

38

COMPUTER ART
Computer graphics methods
are widely used in both fine :

ART &

COMMERCIAL ART.
APPLICATIONS.

DTEIT 19/8/

CG-6284

39

ENTERTAINMENT
Computer graphics methods are
now commonly used in making :

MOTION PICTURES,

MUSIC VIDEOS,

TELEVISION SHOWS.

DTEIT 19/8/

CG-6284

40

EDUCATION & TRAINING


Computer generated models of physical,
financial, and
economic systems are often
used as educational aids.

Models of physical systems, population


trends, or equipment, such as the color coded
diagram can help trainees to understand the
operation of the system.

DTEIT 19/8/

CG-6284

41

EDUCATION & TRAINING

Population trends, or equipment, such

as the color coded diagram can help


trainees to understand the operation of the
system.

DTEIT 19/8/

CG-6284

42

VISUALIZATION

Producing graphical repress-entertains


for scientific, engineering, and medical data
sets and processes is generally referred to as
scientific visualization.
The term business visualization is used
in connection with data sets related to
commerce , industry, and other nonscientific
areas.

DTEIT 19/8/

CG-6284

43

IMAGE PROCESSING
IMAGE PROCESSING Applies techniques

to modify or interpret existing pictures, such as

PHOTOGRAPHS AND

TV SCANS.

APPLICATIONS OF IMAGE PROCESSING


ARE :

DTEIT 19/8/

CG-6284

44

IMAGE PROCESSING

IMPROVING PICTURE QUALITY,

MACHINE PRECEPTION OF VISUAL


INFORMATION AS USED IN
ROBOTICS,

RETOUNCING & REARRANGING OF


SECTIONS OF PHOTOGRAPHS

AND OTHER ART-WORK.

DTEIT 19/8/

CG-6284

45

GRAPHICAL USER

INTERFACES
Graphical interface is a window
manager that allows a user to display
multiple-window areas.
Interfaces also display menus and
menus for fast selection of processing
options.

DTEIT 19/8/

CG-6284

46

PROCESS CONTROL

Status displays in

REFINERIES ,
POWER PLANTS &
COMPUTER NETWORKS

Show data values from sensors attached to


critical system components, so that operators
can respond to problematic conditions.

DTEIT 19/8/

CG-6284

47

PROCESS CONTROL

IN IT

FLIGHT SIMULATORS OR

ARCADE GAMES

Let users interact with a simulation


of a real or artificial world.

DTEIT 19/8/

CG-6284

48

CARTOGRAPHY

Computer graphics is used to produce both


accurate and schematic representations of :

GEOGRAPHICAL AND
OTHER NATURAL PHENOMENA

from

measurement data.
Examples :-

DTEIT 19/8/

CG-6284

49

e.g.
GEOGRAHPICAL MAPS,
RELIEF MAPS,

EXPLORATION MAPS FOR DRILLING &


MINING,

WHEATHER MAPS &


POPULATION DENSITY MAPS.
DTEIT 19/8/

CG-6284

50

CLASSIFICATION OF
APPLICATIONS
First classification is by type (dimensionality) of
the object to be represented and the kind of picture
to be produced.

The second classification is by the type of


interaction, which determines the users degree of
control over the object & its image

DTEIT 19/8/

CG-6284

51

CLASSIFICATION OF
APPLICATIONS
The 3rd classification is by the role
of the picture , or the degree to which
the picture is an end in itself or is
merely a means to an end.
Final categorization arises from the
logical temporal relationship between
objects & their pictures.

DTEIT 19/8/

CG-6284

52

CLASSIFIACTION OF
COMPUTER GRAPHICS BY
OBJECT & PICTURE
TYPE OF
OBJECT
2-D

PICTORIAL REPRESENTATION

LINE DRAWING,
GRAY SCALE IMAGE,

DTEIT 19/8/

COLOR IMAGE

CG-6284

53

TYPE OF
OBJECT

PICTORIAL REPRESENTATION

3-D
LINE DRAWING (WIREFRAME),
DRAWING WITH VARIOUS EFFECTS,

LINE

SHADED,
COLOR IMAGE WITH VARIOUS

DTEIT 19/8/

CG-6284

EFFECTS.

54

CONCEPTUAL FRAMEWORK
FOR INTERACTIVE GRAPHICS

APPLICATION
MODEL

APPLICATION
PROGRAM

V.D.U.
GRAPHICS
SYSTEM

INPUT DEVICES

CONCEPTUAL FRAMEWORK FOR INTERACTIVE GRAPHICS

DTEIT 19/8/

CG-6284

55


APPLICATION PROGRAM : IT
CREATES,
STORES
INTO,
AND
RETRIEVES FROM THE APPLICATION
MODEL.

APPLICATION MODEL : WHICH


REPRESENTS THE DATA OR OBJECTS
TO BE PICTURED ON THE SCREEN.

VIDEO DISPLAY UNIT

INPUT DEVICES

DTEIT 19/8/

CG-6284

56

GRAPHICS SYSTEM

GRAPHICS SYSTEM :

# A series of graphics output commands

that contain both a detailed geometric of


what is to be viewed and the attributes
describing how the objects should appear.

DTEIT 19/8/

CG-6284

57

GRAPHICS SYSTEM
# The graphics system is an intermediary

between the application program and the


display hardware that effects an output
transformation from objects in the
application model to a view of the model.

DTEIT 19/8/

CG-6284

58

GRAPHICS SYSTEM
# It effects an input trans-formation

from user action to input to the


applications program that will cause
the application program that will cause
the application to make changes in the
model and or picture.
DTEIT 19/8/

CG-6284

59

COMPONENTS OF
GRAPHICS SYSTEM

VIDEO DISPLAY DEVICES

RASTER SCAN SYSTEMS

RANDOM SCAN SYSTEMS

GRAPHIC MONITERS & WORKSTATIONS

INPUT DEVICES

HARD COPY DEVICES

GRAPHIC SOFTWARE.
DTEIT 19/8/

CG-6284

60

APPLICATION MODEL

The application model captures all the

DATA,

OBJECTS AND

RELATIONSHIPS Among then that are

relevant to the display and interaction part


of the application program and to any
non graphical

DTEIT 19/8/

CG-6284

61

APPLICATION MODEL
Postprocessing modules.
# Examples of such post-processing
module are analyses of the transient
behavior of a circuit or of the stress in an
aircraft wing.

DTEIT 19/8/

CG-6284

62

APPLICATION MODEL
# A data model can be as rudimentary as

an array of data points or as complex as


a linked list representing a network data
structure or a relational database the
terms are used interchangeably.

DTEIT 19/8/

CG-6284

63

APPLICATION MODEL
# Models typically store descriptions of

primitives that define the shape of


components of the object attributes such
as line style, color,or surface texture;and
connectivity relationships and positioning
data that describe how the components fit
together.
DTEIT 19/8/

CG-6284

64

MAJOR RASTER-SCAN CRT COMPONENTS

1. ELECTRON
GUN
2. CONTROL ELECTRODE
3. FOCUSING ELECTRODE
4. DEFLECTION YOKE
5. PHOSPHORUS-COATED SCREEN

DTEIT 19/8/

CG-6284

65

CRT COMPONENTS
ELECTRON GUN

Consisting of a series of components


which together cause electrons to
congregate at the end of the electron
gun.

The electrons are then accelerated by


application of an electric field.
DTEIT 19/8/

CG-6284

66

CRT COMPONENTS

CONTROL ELECTRODE

Used to regulate the flow of electrons.


The control electrode is connected to an
amplifier which is connected to the output
circuitry of the computer.
Thus allowing the computer to control
when the electron beam is turned off and on.

DTEIT 19/8/

CG-6284

67

CRT COMPONENTS
FOCUSING ELECTRODE

Used to create a clean picture by


focusing the electrons into a narrow beam.

The focusing electrode serves this


purpose by exerting an electromagnetic
force on the electrons in the electron beam.

DTEIT 19/8/

CG-6284

68

CRT COMPONENTS
DEFLECTION YOKE :

Used to control the direction of the electron beam.

It creates an electric or magnetic field which will


bend the electron beam as it passes through field.
In a conventional CRT the yoke is connected to a
sweep or scan generator.

DTEIT 19/8/

CG-6284

69

EXAMPLE OF SIGNAL FROM SCAN GENERATOR


SCAN

RETRACE

DTEIT 19/8/

CG-6284

70

CRT COMPONENTS
PHOSPHORUS-COATED SCREEN

Phosphorus coating on the inside front


surface of every CRT.

This surface is coated with special crystals


called phosphorus,which have a unique
property that allows the entire system to work.

DTEIT 19/8/

CG-6284

71

CRT COMPONENTS

REFRESH AND FLICKER

Each time the electron beam goes


through a complete cycle of raster or scan
lines, the CRT is said to be refreshed.

DTEIT 19/8/

CG-6284

72

CRT COMPONENTS
It is very important that the persistence of
the phosphor used and the refresh rate be
matched.

Otherwise, an image on the CRT may


appear to flash rapidly on and off. When
flashing of this type does occur, it is called
flicker.

DTEIT 19/8/

CG-6284

73

CRT COMPONENTS

INTERLACING

Since the perceptual threshold is greater


than the frequency of standard line voltage,
then a technique called interlacing is often
used.
Again, the refresh rate and the persistence
of the phosphor must be matched.

DTEIT 19/8/

CG-6284

74

INTERFACING
RASTER LINE
NUMBER
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31

ODD RASTER LINES

DTEIT 19/8/

0
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30

EVEN RASTER LINES

CG-6284

75

CRT COMPONENTS
If the refresh rate is greater than the
phosphors persistence, moving objects
will tend to become blurred.

On the other hand, if the refresh rate


significantly longer than the phosphors
persistence , the user will perceive flicker.

DTEIT 19/8/

CG-6284

76

CRT COMPONENTS
ASPECT RATIO

Aspect ratio is an output devices


width-height most standard CRTs
have a display area with an aspect ratio
of 4:3 is shown in figure :
12 in

9 in
DTEIT 19/8/

VIEWABLE AREA ON
A CRT

CG-6284

77

CRT COMPONENTS

RESOLUTION

The graphics programmer must also


consider resolution of the system .

resolution is normally described in terms of


the number of pixel.

For example, if a system can produce 512


pixels in the horizontal direction and 384
pixels in the vertical, the device would be
described as having a 512*384 pixels display.
DTEIT 19/8/

CG-6284

78

CRT COMPONENTS

SQUARENESS

Squareness is the ability of a system to


accurately reproduce a square model in the
computer memory as a square on the display
with no manipulation other than uniformly
scaling the model to the memory map.

If the aspect ratio and resolution are not


equal, it is often impossible to do this scaling
without the use floating point division.
DTEIT 19/8/

CG-6284

79

CRT COMPONENTS
FIT
Fit is how well model data will fit in
the memory map without scaling.

In fitting model data to the


memory map
# it is best to work within
boundaries of the memory map.

DTEIT 19/8/

CG-6284

80

VIDEO DISPLAY DEVICES


The primary 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.

DTEIT 19/8/

CG-6284

81

VIDEO DISPLAY DEVICES

But most other technologies exist

& solid state monitors may eventually


predominate.

DTEIT 19/8/

CG-6284

82

MAGENTIC DEFLECTION COILS


BASE

FOCUSING
SYSTEM
PHOSPHOR
COATED
SCREEN

CONNECTOR
PINS

ELECTRON
BEAM

ELECTRON
GUN

BASIC DESIGN OF MAGENTIC DEFLECTION CRT.

DTEIT 19/8/

CG-6284

83

REFRESH CATHOD RAY TUBES

WORKING

A beam of electrons emitted by an electron


gun,

Passes through focusing,

and then deflection systems that direct the


beam on the phosphor-coated screen.

DTEIT 19/8/

CG-6284

84

REFRESH CATHOD RAY TUBES


To keep the phosphor glowing is
to redraw the picture repeatedly by
quickly directing the electron beam
back over the same points.
This type of display is called a
Refresh CRT.

DTEIT 19/8/

CG-6284

85

CATHODE

FOCUSING
ANODE

ELECTRON
BEAM PATH

HEATING
FILAMENT
CONTROL GRID

ACCELRATING
ANODE

OPERATION OF ELECTRONIC GUN WITH AN


ACCELRATING ANODE
DTEIT 19/8/

CG-6284

86

OPERATION OF ELECTRONIC GUN


WITH AN ACCELRATING ANODE

Heat is supplied to the cathode by directing


a current through a coil of wire called
filament.
In the vacuum inside the CRT envelope,
#
the free,
# negatively charged electrons are then

DTEIT 19/8/

CG-6284

87

OPERATION OF ELECTRONIC GUN

Accelrated toward the phosphor


coating by a high positive voltage.

The accelrating voltage can be


generated with a positively charged metal
coating on the inside of the CRT
envelope near the phosphor screen.

DTEIT 19/8/

CG-6284

88

OPERATION OF ELECTRONIC GUN


Magnetic lens focusing products the

smallest spot size on the screen.


Spots of light are produced on the
screen by the transfer of the CRT beam
energy to the phosphor.

DTEIT 19/8/

CG-6284

89

OPERATION OF ELECTRONIC GUN

The frequency
or
color of
light emitted by the phosphor is
proportional to the energy difference
between the excited quantum state & the
ground state.

DTEIT 19/8/

CG-6284

90

OPERATION OF ELECTRONIC GUN


Different types of phosphors are availble for

use in crt.
Besides color , a major difference between
phosphors is their perisistence :
# how long they continue to emit light i.e.

DTEIT 19/8/

CG-6284

91

OPERATION OF ELECTRONIC GUN


that is have excited electrons returning to the
ground state after the CRT beam is removed.

PERSISTENCE is defined as the time it

takes the emitted light from the screen to decay


to one tenth of its original intensity.

DTEIT 19/8/

CG-6284

92

OPERATION OF ELECTRONIC GUN

PERSISTENCE
A phosphor with low persistence is useful
for animation ;
A high persistence phosphor is useful for
displaying highly complex, static pictures.

DTEIT 19/8/

CG-6284

93

OPERATION OF ELECTRONIC GUN

Some phosphors have a persistence


greater than one second,

Graphic monitors are usually


constructed with the persistence in
range from 10-60 micro-seconds.

DTEIT 19/8/

CG-6284

94

OPERATION OF ELECTRONIC GUN

Maximum no of points that can


displayed without on a CRT is referred to
as resolution.

A more precise definition of resolution


is the no. of points per centimeter that
can be plotted horizontally or vertically.

DTEIT 19/8/

CG-6284

95

OPERATION OF ELECTRONIC GUN

Resolution of a CRT is dependent on

The type of phosphor,

The intensity to be displayed and

The focusing & deflection systems.

DTEIT 19/8/

CG-6284

96

OPERATION OF ELECTRONIC GUN


Typical resolution on high quality systems is
1280 by 1024.
High resolution systems are often referred to as
high definition systems.

The physical size of graphic monitor is given as


the length of screen diagonal, with sizes varying
from about 12 to 27 or more.

DTEIT 19/8/

CG-6284

97

OPERATION OF ELECTRONIC GUN

Another property of video monitors is


aspect ratio.

This number gives the ratio of vertical


points to horizontal points necessary to
produce equal length lines
in both
directions on the screen.

DTEIT 19/8/

CG-6284

98

OPERATION OF ELECTRONIC GUN

Some times aspect ratio is stated in terms


of the ratio of horizontal to vertical points.

An aspect ratio of 3/4 means that a


vertical line plotted with three points has the
same length as the horizontal line plotted
with four points.

DTEIT 19/8/

CG-6284

99

RASTER SCAN DISPLAY

In a raster scan system, electron beam is


swept across the screen, one row at a time
from top to bottom. As the electron beam
moves across each row, the beam intensity
is turned on and off to create pattern of
luminated spots.

DTEIT 19/8/

CG-6284

100

RASTER SCAN DISPLAY

A RASTER SCAN SYSTEM DISPLAYS AN OBJECT AS


A SET OF DISCRETE POINTS ACROOS EACH SCAN
LINE.
DTEIT 19/8/

CG-6284

101

RASTER SCAN DISPLAY


Picture defination is stored in a memory
area called the refresh buffer or frame buffer.

This memory area holds the set of


intensity values are then retrieved from the
refresh buffer and painted on the screen one
row(scan line ) at a time.

DTEIT 19/8/

CG-6284

102

RASTER SCAN DISPLAY


Each screen point is referred to as a pixel or pel
or picture element.

In a simple black and white system each screen


point is either on or off so only one bit per pixel is
needed to control the intensity of screen positions.

DTEIT 19/8/

CG-6284

103

RASTER SCAN DISPLAY


For a bilevel system, a bit value of 1
indicates that the electron beam is to be
turned on at that position , & a value of
0 indicates that the beam intensity is to
be off.
Additional bits are needed when color
and intensity variations can be displayed.

DTEIT 19/8/

CG-6284

104

RASTER SCAN DISPLAY

Up to 24 bits per pixel are included in high


quality
systems, which require
several
megabytes of storage for the frame buffer,
depending on resolution of the system.
A system with 24 bits per pixel and a screen
resolution of 1024 x 1024 requires 3 megabytes
of storage for frame buffer, on a black and white
system with one bit per pixel.

DTEIT 19/8/

CG-6284

105

RASTER SCAN DISPLAY


The frame buffer is commonly called
bitmap.
For systems with multiple bits per pixel, the
frame buffer is often referred to as a pixmap.
Refreshing on raster scan displays is carried
out at the rate of 60 to 80 frames per seconds.

DTEIT 19/8/

CG-6284

106

RASTER SCAN DISPLAY

Some systems are designed for higher refresh rates.

Some times, refresh rates are described in unit of


cycle per second or Hz, where a cycle corresponds to
on frame.
Using these units : we would describe a refresh rate
of 60 frames per sec as simply 60 Hz.

DTEIT 19/8/

CG-6284

107

RASTER SCAN
Scan Line

Horizontal
Retrace

Vertical
Retrace

Today a 60 Hz or higher refresh rate is used to


avoid flickering of the image.

In a raster system the entire image of, 1024 lines


of 1024 pixels each.
DTEIT 19/8/

CG-6284

108

RASTER SCAN DISPLAY


At the end of each scan line the electron
beam returns to the left side of the screen to
begin displaying the next scan line.

Then return to the left of screen.

After refreshing each scan line is called


the horizontal retrace of the electron beam.

DTEIT 19/8/

CG-6284

109

RASTER SCAN DISPLAY


And at the end of each frame
(display in 1/80th to 1/60th of a
second) ,

The electron beam returns to the top


left corner of the screen to begin the
next frame is called vertical retrace.
DTEIT 19/8/

CG-6284

110

RANDOM-SCAN
DISPLAY
In a random-scan display unit,
a CRT has the

electron beam directed only to the parts of the


screen where a picture is to be drawn.
Random scan monitors draw a picture one line at
a time and for this reason are also refer to as
Vector displays (stroke-writing) or Calligraphic
displays.

DTEIT 19/8/

CG-6284

111

RANDOM-SCAN DISPLAY

A RANDOM SCAN SYSTEM DRAWS THE


COMPONENT LINES OF AN OBJECT IN ANY
ORDER SPECIFIED.
DTEIT 19/8/

CG-6284

112

RANDOM-SCAN DISPLAY
A pen plotter operates in a similar way
and is an example of random scan,
hardcopy device.

Refresh rate on a random scan system


depends on the no. of lines to be displayed.

DTEIT 19/8/

CG-6284

113

RANDOM-SCAN DISPLAY
Picture defination is now stored as a set of
line drawing commands in an area of memory
referred to as refresh display file.
Some times refresh display file is called
display list
display program or
simply the refresh buffer.

DTEIT 19/8/

CG-6284

114

RANDOM-SCAN DISPLAY
Random scan displays are designed to
draw all the component lines of a picture
30 to 60 times each second.
High quality vector systems are capable
of handling approximately 100,000 short
lines at this refresh rate.

DTEIT 19/8/

CG-6284

115

RANDOM-SCAN DISPLAY

Random-scan systems are designed for :

Line-drawing applications and


Cannot display realistic shaded scenes.

Vector displays generally have higher

resolution than raster systems.

DTEIT 19/8/

CG-6284

116

RANDOM-SCAN DISPLAY
Also vector displays produce smooth line
drawing because the CRT beam directly
follows the line path.

A raster systems , in contrast , produces


jagged lines that are plotted as discrete point
sets.

DTEIT 19/8/

CG-6284

117

RANDOM SCAN VERSUS


RASTER SCAN

IDEAL LINE DRAWING

RASTER SCAN WITH OUTLINE PRIMITIVES

DTEIT 19/8/

VECTOR SCAN

RASTER SCAN WITH FILLED PRIMITIVES

CG-6284

118

COLOUR CRT MONITORS


A CRT monitor display color pictures
by using a combination of phosphors that
emit different- colored light.

Two basic techniques for producing


color displays with CRT are :
The beam penetration method.
The shadow-mask method.

DTEIT 19/8/

CG-6284

119

BEAM -PENETRATION

The beam penetration method for


displaying color pictures has been with
random scan monitors.
Two layers of phosphor, usually red and
green are coated on to the inside of the CRT
screen and the displayed color depends on
how for the electron beam penetrates into the
phosphor layers.

DTEIT 19/8/

CG-6284

120

BEAM -PENETRATION
A beam of slow electron excites only the
outer red layer.
A beam of very fast electrons penetrates
through the red layer and excites the inner
green layer.

DTEIT 19/8/

CG-6284

121

BEAM -PENETRATION
Beam penetration has been an
inexpensive way to produce color in
random scan monitors, but only four
colors are possible, and the quietly of
picture is not as good as with other
methods .
DTEIT 19/8/

CG-6284

122

SHADOW MASK METHOD


ELECTRON
GUNS

SELECTION OF
SHADOW
MASK

MAGNIFIED
PHOSPHOR-DOT
TRIANGLE

RED
GREEN BLUE

SCREEN

DTEIT 19/8/

CG-6284

123

SHADOW-MASK

Shadow-mask methods are commonly


used in raster-scan systems, the delta-delta
shadow-mask methods, commonly used in
color CRT systems.
When the three beam pass through a hole
in shadow-mask, they activate a dot triangle,
which appears as small color spot on the
screen.

DTEIT 19/8/

CG-6284

124

SHADOW-MASK

The phosphor dots in the triangles are


arranged so that each electron beam can
activate only its corresponding color dot
when it pass through the shadow-mask.

DTEIT 19/8/

CG-6284

125

DIRECT VIEW STORAGE TUBES

A direct view storage tube stores the picture


information as a charge distribution just behind
the phosphor-coated screen.
Two electron guns are used in a DVST.

One the primary gun is used to store the


picture pattern.

The flood gun, maintains the picture


display.
DTEIT 19/8/

CG-6284

126

FLAT PANEL DISPLAY


The term flat panel display refers to a class
of video devices that have reduced:

VOLUME ,

WEIGHT AND

POWER

Requirements compared to a CRT.

DTEIT 19/8/

CG-6284

127

FLAT PANEL DISPLAY

We can separate flat panel displays into two

categories :

EMISSIVE DISPLAY
OR
EMITTERS

Are devices that convert electrical energy into light.

DTEIT 19/8/

CG-6284

128

FLAT PANEL DISPLAY


EXAMPLES OF EMISSIVE DISPLAY
# PLASMA PANELS,
# THIN FILM ELCTRO
LUMINESCENT DISPLAYS &
# LIGHT EMITTING DIODES

DTEIT 19/8/

CG-6284

129

FLAT PANEL DISPLAY

NON-EMISSIVE DISPLAY OR NON EMITERS

Use optical effects to convert sunlight or light

from some other source into graphics pattern.


Important example is a liquid crystal device
(LCD).

DTEIT 19/8/

CG-6284

130

FLAT PANEL DISPLAY


PLASMA PANELS OR GASDISCHARGE DISPLAYS : Are
constructed by filling the region
between two glass plates with a
mixture of gases that usually includes
neon.

DTEIT 19/8/

CG-6284

131

PLASMA DISPLAY TECHNOLOGIES


The components of a plasma and
related displays are as follows :

CATHODES :

Fine wires attached to a glass plate


which delivers negative voltage to the gas
cells on the vertical axis.

DTEIT 19/8/

CG-6284

132

PLASMA DISPLAY TECHNOLOGIES


FLUORESCENT CELLS

# Small pockets of gas liquids or solids

are excited when a voltage is applied.


# In the excited state the substance
emits light.

DTEIT 19/8/

CG-6284

133

PLASMA DISPLAY TECHNOLOGIES


GLASS PLATES

# Plates that act as capacitor in dc plasma

display and maintain voltage to ensure that


a cell will continue to glow after the cell
has received a single burst of power.

DTEIT 19/8/

CG-6284

134

PLASMA DISPLAY TECHNOLOGIES


# To remain lit, alternating-current plasma

display must supply background voltage.

ANODES

# Fine wires attached to a glass plate

supply positive voltage along horizontal


axis.

DTEIT 19/8/

CG-6284

135

1. CATHODE
2. ELECTROFLUORESESCENT
MATERIAL

3. ANODE
4. GLASS
PLATES

ELECTROFLUORESESCENT DISPLAY
DTEIT 19/8/

CG-6284

136

FILM ELECTROLUMINESCENT DISPLAYS


FILM

ELECTROLUMINESCENT

DISPLAYS are similar in construction to a

plasma panel.
The difference is that the region between the
glass plates is filled with a phosphor, such as
zinc sulfide doped with manganese.

DTEIT 19/8/

CG-6284

137

FILM ELECTROLUMINESCENT DISPLAYS

Electroluminescent
displays
require more power than plasma
panels
Good color and
Gray scale displaced are hard to
achieve.

DTEIT 19/8/

CG-6284

138

FLAT PANEL DISPLAY


LIGHT EMITTING DIODES

A matrix of diodes is arranged to form the

pixel positions in the display ,

and picture definition is stored in a refresh

buffer.

DTEIT 19/8/

CG-6284

139

LIQUID CRYSTAL DISPLAY

LIQUID CRYSTAL DISPLAY (LCD)

These non-emissive devices produce a


picture by passing polarized light from the
surroundings or from an internal light source
through a liquid-crystal material that can be
aligned to either block or transmit the light.
#

DTEIT 19/8/

CG-6284

140

LIQUID CRYSTAL DISPLAY

Unlike most other types of display, liquid

crystal displays(LCDs) depend on an


outside light source.
This is because LCDs work by polarizing
ambient light.
Liquid crystal displays can be viewed
only front a limited angle.

DTEIT 19/8/

CG-6284

141

LIQUID CRYSTAL DISPLAY

To observe this, hold a calculator that


uses an LCD at arms length in front of
you.
Next, turn the calculator slowly back and
forth along its vertical axis. You should
observe the number on the display
fading as calculator display makes a
greater angle with your line of sight.

DTEIT 19/8/

CG-6284

142

A LIQUID CRYSTAL DISPLAY CELL


DISPLAY DEVICES

Liquid crystal
3
Conducting
coating
2

Trans1 parent
plates

4 Polarized film
DTEIT 19/8/

CG-6284

143

LIQUID CRYSTAL DISPLAY


The basic components of an LCDs are as follows :
GLASS OR PLASTIC PLATE
# Contains liquid crystal and serves as a bonding
surface for a conductive coating.
CONDUCTIVE COATING
# Acts as a conductor so that a voltage can be
applied across the liquid crystal.

DTEIT 19/8/

CG-6284

144

LIQUID CRYSTAL DISPLAY


LIQUID CRYSTAL
# A substance which will polarize light when a
voltage is applied to it.
POLARIZED FILM
# A transparent sheet that polarizes light. The
axis of polarization is set 90 degree out of phase
with the axis of polarization of the liquid crystal.

DTEIT 19/8/

CG-6284

145

WORKING OF LCD

Light passing through the polarized


film (item 4) is polarized, When
attempts to pass through the liquid
crystal (item 3) the ray is annihilated;
thus a dark area is perceived.

DTEIT 19/8/

CG-6284

146

WORKING OF LCD
To observe how this works, take two pairs of
Polaroid sunglasses and put the lenses on top of
each other.
Next, keeping the two lenses on top of each
other, rotate the glasses with respect to each
other. You should notice the lenses appearing to
become darker.

DTEIT 19/8/

CG-6284

147

VECTOR DEVICES
The simplest image or primitive that can
be drawn on the devices discussed so far is a
point.
The simplest image or primitive that can
be drawn on a vector device such as

A memory- tube display or


A plotter is a line.

DTEIT 19/8/

CG-6284

148

VECTOR DEVICES
Vector devices require less computer
memory because only the endpoints of lines
must be stored .
A major problem occurs when the list of
endpoints becomes too long.
The vector CRT is not able to refresh the
line often enough and the display begins to
flicker.
DTEIT 19/8/

CG-6284

149

MEMORY-TUBE DISPLAYS

From the graphics programmer's point of


view, memory-tube display and plotters are quite
similar.
Both are vector devices; that is, the simplest
primitive is a line rather than a point. The
principal components of a memory-tube display
are as follow:

DTEIT 19/8/

CG-6284

150

MEMORY-TUBE DISPLAYS
FLOODING GUN
An electron gun designed to flood the entire
screen with electron. This charges the
collector plate.
PHOSPHORUS GRAINS
Used in a memory-tube display and similar to
those used in a standard CRT except that they
have a much longer persistence.

DTEIT 19/8/

CG-6284

151

MEMORY-TUBE DISPLAYS
WRITING GUN SYSTEM:- Used in a
memory-tube display and basically the same
as the electron gun used in a conventional
CRT. It consist of a series of components
(primerly a heater, a cathode a focusing
electrod, and the deflection yoke) which
together cause electrons to congregate at the
end of the gun.
DTEIT 19/8/

CG-6284

152

MEMORY-TUBE DISPLAYS
COLLECTOR
Already partly energized by the flooding gun,
stores the charge generated by the writing gun.
The background charge from the flooding gun
supplies enough energy so that the phosphors will
continue to phosphoresce indefinitely after they
are hit by writing gun.

DTEIT 19/8/

CG-6284

153

MEMORY-TUBE DISPLAYS
GROUND

Used to discharge the collector.

When the collector is discharged, the


background voltage will drop to zero and
the entire screen will be erased.

DTEIT 19/8/

CG-6284

154

COMPARISON OF DISPLAY
TECHNOLOGIES
POWER CONSUMPTION
CRT

: FAIR

ELECTRO-LUMINESENT : FAIR-GOOD
LIQUID CRYSTAL

: EXELLENT

PLASMA PANEL

: FAIR

DTEIT 19/8/

CG-6284

155

COMPARISON
SCREEN SIZE
CRT

: EXCELLENT

ELECTRO-LUMINESENT : GOOD
LIQUID CRYSTAL

: FAIR

PLASMA PANEL

: EXCELLENT

DTEIT 19/8/

CG-6284

156

COMPARISON

DEPTH
CRT

: POOR

ELECTRO-LUMINESENT : EXCELLENT
LIQUID CRYSTAL

: EXCELLENT

PLASMA PANEL

: GOOD

DTEIT 19/8/

CG-6284

157

COMPARISON
WEIGHT
CRT

: POOR

ELECTRO-LUMINESENT : EXCELLENT
LIQUID CRYSTAL

: EXCELLENT

PLASMA PANEL

: EXCELLENT

DTEIT 19/8/

CG-6284

158

COMPARISON
RUGGEDNESS
CRT

: FAIR-GOOD

ELECTRO-LUMINESENT : G-EXCELLENT
LIQUID CRYSTAL

: EXCELLENT

PLASMA PANEL

: EXCELLENT

DTEIT 19/8/

CG-6284

159

COMPARISON
BRIGHTNESS
CRT

ELECTRO-LUMINESENT EXCELLENT :
LIQUID CRYSTAL

EXCELLENT

PLASMA PANEL

: FAIR-GOOD

DTEIT 19/8/

CG-6284:

EXCELLENT
160

COMPARISON
ADDRESSABILITY
CRT

: EXCELLENT

ELECTRO-LUMINESENT : GOOD
LIQUID CRYSTAL

: FAIR-GOOD

PLASMA PANEL

: GOOD

DTEIT 19/8/

CG-6284

161

COMPARISON
CONTRAST
: EXCELLENT

CRT

ELECTRO-LUMINESENT : GOOD
LIQUID CRYSTAL

: FAIR

PLASMA PANEL

: GOOD

DTEIT 19/8/

CG-6284

162

COMPARISON
INTENSITY LEVEL PER DOT
: EXCELLENT

CRT

ELECTRO-LUMINESENT : FAIR
LIQUID CRYSTAL

: FAIR

PLASMA PANEL

: FAIR

DTEIT 19/8/

CG-6284

163

COMPARISON
VIEWING ANGLE
: EXCELLENT

CRT

ELECTRO-LUMINESENT : GOOD
LIQUID CRYSTAL

: POOR

PLASMA PANEL

: G-EXCELLENT

DTEIT 19/8/

CG-6284

164

COMPARISON
COLOR CAPABILITY
CRT

: EXCELLENT

ELECTRO-LUMINESENT : GOOD
LIQUID CRYSTAL

: GOOD

PLASMA PANEL

: FAIR

DTEIT 19/8/

CG-6284

165

COMPARISON
RELATIVE COST RANGE
CRT

: LOW

ELECTRO-LUMINESENT : MEDIUM-HIGH
LIQUID CRYSTAL

: LOW

PLASMA PANEL

: HIGH

DTEIT 19/8/

CG-6284

166

RASTER SCAN SYSTEM

Interactive raster graphics systems typically

employ several processing units.


In addition to the CPU, a special
purpose
processor called video-controller or display
controller , is used to control the operation the
display device.

DTEIT 19/8/

CG-6284

167

RASTER SCAN SYSTEM


The frame buffer can be any where in the
system memory & the video controller access
the frame buffer to refresh the screen.
More sophisticated raster systems employ
other processors as coprocessor and
accelerators.

DTEIT 19/8/

CG-6284

168

RASTER SCAN SYSTEM


VIDEO CONTROLLER:
C.P.U.

SYSTEM
MEMORY

FRAME
BUFFER

VIDEO
CONTROLLER

MONITOR

SYSTEM BUS
I/O DEVICES

DTEIT 19/8/

CG-6284

169

VIDEO CONTROLLER
A fixed area of the system memory is
reserved for the frame buffer, and the video
controller is given direct access to the framebuffer memory.
Locations & corresponding screen
positions are referenced in Cartesian
coordinates.

DTEIT 19/8/

CG-6284

170

VIDEO CONTROLLER
The origin of the
coordinate system for
identifying
screen
positions is usually
specified in the lower
left corner.

DTEIT 19/8/

CG-6284

171

VIDEO CONTROLLER

The screen surface is then represented as

the first quadrant of a 2-d system, with


positive x values increasing to the right &
positive y values increasing from bottom to
top.

DTEIT 19/8/

CG-6284

172

VIDEO CONTROLLER

Scan lines are then labeled from y max

At the top of the screen to 0 (zero) at the


bottom.
Along each scan line, screen pixel
positions are labeled from 0 to x max.

DTEIT 19/8/

CG-6284

173

VIDEO CONTROLLER
Two registers are used to store the
coordinates of the screen pixels.

Initially, the x register set to zero &


the y register is set to ymax.

DTEIT 19/8/

CG-6284

174

VIDEO CONTROLLER
The x register is incremented by 1 & the

process repeated for next pixel on the top


scan line.
This procedure is repeated for each pixel

along the scan line.

DTEIT 19/8/

CG-6284

175

VIDEO CONTROLLER

After the last pixel on the top scan

line has been processed, the x register


is reset to zero & the y register is
decremented by 1.

DTEIT 19/8/

CG-6284

176

VIDEO CONTROLLER
Screen must be refreshed at rate of 60
frames per second.

To speed up pixel processing, video


controller can retrieve multiple pixel values
from the refresh buffer on each pass.

DTEIT 19/8/

CG-6284

177

BASIC VIDEO CONTROLLER


REFRESH OPERATION
RASTER SCAN
GENERATOR

X
REGISTER

HORIZONTAL &
VERTICAL DEFLCTION
VOLTAGES

Y
REGISTER

MEMORY
ADDRESS

PIXEL
REGISTER

INTENSITY

FRAME BUFFER

DTEIT 19/8/

CG-6284

178

ARCHITECTURE OF A RASTER-GRAPHICS
SYSTEM WITH A DISPLAY PROCESSOR

DISPLAY
PRCESSOR
MEMORY

C.P.U.

FRAME
BUFFER

DISPLAY
PROCESSOR

VIDEO
CONTROLLER

MONITOR

SYSTEM
MEMORY

SYSTEM BUS
I/O DEVICES

DTEIT 19/8/

CG-6284

179

RASTER SCAN DISPLAY


PROCESSOR

One way to setup the organization of a

raster system containing separate display


processor, some times referred to as a
graphics

controller

or

display

coprocessor.

DTEIT 19/8/

CG-6284

180

RASTER SCAN DISPLAY PROCESSOR

The purpose of the display processor is to


free the CPU from the graphics chores.
In addition to the system memory,
separate display processor memory area
can also be provided.

DTEIT 19/8/

CG-6284

181

A CHARACTER DEFINED AS A RECTANGULAR


GRID OF PIXEL POSITIONS.

DTEIT 19/8/

CG-6284

182

RASTER SCAN DISPLAY PROCESSOR

A major task of the display processor is


digitizing a picture definition given in an
application program into a set of pixel-intensity
values for storage in the frame buffer.

This process is called scan conversion.

DTEIT 19/8/

CG-6284

183

RASTER SCAN DISPLAY PROCESSOR

Scan converting a straight line


segment, for example, means that we
have to locate the pixel positions closest
to the line path & store the intensity for
each position in the frame buffer.

DTEIT 19/8/

CG-6284

184

RASTER SCAN DISPLAY PROCESSOR

SIMILAR METHODS ARE USED FOR


SCAN CONVERTING CURVED LINES &
POLYGON OUTLINES.

CHARACTERS CAN BE DEFINED WITH


RECTANGULAR GRIDS OR THEY CAN BE
DEFINED WITH CURVED OUTLINES.

DTEIT 19/8/

CG-6284

185

RANDOM SCAN SYSTEMS

Graphics commands in the application

program are translated by the graphics


package into a display file stored in the
system memory.

DTEIT 19/8/

CG-6284

186

ARCHITECTURE OF A SIMPLE RANDOM


SCAN SYSTEM

C.P.U.

SYSTEM
MEMORY

DISPLAY
PROCESSOR

MONITOR

SYSTEM BUS
I/O DEVICES

DTEIT 19/8/

CG-6284

187

RANDOM SCAN SYSTEMS


This display file is then accessed by the
display processor to refresh the screen.
The display processor cycles through
each command in the display file program
once during every refresh cycle.

DTEIT 19/8/

CG-6284

188

RANDOM SCAN SYSTEMS

Some times the display processor in

a random scan system is referred to as

a display processing unit or

a graphics controller.

DTEIT 19/8/

CG-6284

189

3-D VIEWING DEVICES


Graphics monitors for the display of
3-D scenes have been devised using a
technique that reflects a CRT image
from a vibrating flexible mirror.
As the vari-focal mirror vibrates, it
changes focal length.

DTEIT 19/8/

CG-6284

190

3 - DIMENTIONAL
VIEWING DEVICES
OPERATION OF
3D - DISPLAY
SYSTEM USING
A
VIBRATING
MIRROR
THAT
CHANGES
FOCAL LENGTH
TO MATH THE
DEPTH
OF
POINTS IN A
SCENE

DTEIT 19/8/

TIMING &
CONTROL
SYSTEM

Projected
3D Image
Vibrating
Flexible Mirror

CRT
Viewer

CG-6284

191

3-D VIEWING DEVICES


These vibrations are synchronized with the
display of an object on the CRT so that each
point on the object is reflected from the mirror
into a spatial position corresponding to the
distance of that point from a specified a
viewing position.

DTEIT 19/8/

CG-6284

192

3-D VIEWING DEVICES


This allows us to walk around an object or
scene & view it from different sides.

Such systems have been used

In medical applications to analyze data from


ultrasonography & cat scan devices,
In geological

applications

to

analyze

DTEIT 19/8/

CG-6284

193

3-D VIEWING DEVICES


topological & seismic data,
In design applications involving solid
objects &
In 3-d simulations of systems, such as
molecules & terrain.
DTEIT 19/8/

CG-6284

194

STEREOSCOPIC & VIRTUAL


REALITY SYSTEM.
Another technique for representing 3-D
objects on displaying stereoscopic views.
This method does not produce true 3-D
images, but it does provide a 3-D effect by
presenting a different view to each eye of
an observer so that scenes do appear to
have depth.
DTEIT 19/8/

CG-6284

195

STEREOSCOPIC & VIRTUAL REALITY SYSTEM

To obtain a stereoscopic
projection, we first need to obtain 2
views of scene generated from a
viewing direction corresponding to
each eye.

DTEIT 19/8/

CG-6284

196

STEREOSCOPIC & VIRTUAL REALITY SYSTEM

We can construct the two views as


computer-generated scene with different
viewing positions.
When we simultaneous look at left view
with the eye & the right view with the right
eye, the two views merge into a single image &
we perceive scene with depth.

DTEIT 19/8/

CG-6284

197

STEREOSCOPIC & VIRTUAL REALITY SYSTEM

One way to produce a stereoscopic effect


is to display eye of two views with a raster
system on alternate refresh cycle.
Stereoscopic viewing is also a component
in virtual-reality systems, where users can
step into sense & interact with the
environment.

DTEIT 19/8/

CG-6284

198

STEREOSCOPIC & VIRTUAL REALITY SYSTEM

A headset containing an optical


system to generate the stereoscopic
views is commonly used in conjunction
with interactive input devices to locate
& manipulate object in the scene.

DTEIT 19/8/

CG-6284

199

STEREOSCOPIC & VIRTUAL REALITY SYSTEM

A sensing system in the headset


keeps track of the viewers position, so
that the front & back of objects can be
seen as the viewer walks through &
interacts with the display.

DTEIT 19/8/

CG-6284

200

ARCHITECHTURE OF
RASTER DISPLAY
INTERFACE WITH HOST COMPUTER
(DISPLAY COMMANDS)

000000000000000000000000
000000000001000000000000
0000000001111110000000000
0000001111111111000000000
00001111111111110000000000
0011110000111110000000000
0111100001111100000000000
1111000011111000000000001
11111111111100000000000000
000000000000000

(INTERACTION DATA)

DISPLAY
CONTROLLER

MOUSE

VIDEO
CONTROLLER

MONITOR

REFRESHER BUFFER

DTEIT 19/8/

KEYBOARD

CG-6284

201

INPUT DEVICES

KEYBOARD

An alphanumeric keyboard on a graphic


system is used primarily as a device for
entering text strings.

Keyboard is primary input device.

DTEIT 19/8/

CG-6284

202

KEYBOARD
The keyboard is an efficient device
for inputting such non-graphic data as a
picture labels associated with a graphics
display.
It is used to type any text on the
screen.

DTEIT 19/8/

CG-6284

203

KEYBOARD
TYPES OF KEYBOARD
83-key PC and XT keyboard.
84-key AT keyboard.
101-key enhanced keyboard.

DTEIT 19/8/

CG-6284

204

KEYBOARD
SECTIONS OF KEYBOARD
Typing area.
Numeric keypad.
Cursor and screen controls.
Function keys.
DTEIT 19/8/

CG-6284

205

INPUT DEVICES

MOUSE

A mouse is hand held box used to position the


screen cursor.
Wheels or rollers on the bottom of the mouse
can be used to record the amount and
direction of movement.

DTEIT 19/8/

CG-6284

206

MOUSE
Famous as an input device.
Mostly used for pointing the pictures.

COMPONENTS
A housing to hold in hand & move
around on desktop.

DTEIT 19/8/

CG-6284

207

MOUSE
A roller ball that signals movement
to the system.
Two buttons for making selections.
A cable for connecting the mouse to
the system.

DTEIT 19/8/

CG-6284

208

INPUT DEVICES

TRACKBALL AND SPACEBALL

As the name implies, a trackball is a ball

that can be rotated with the fingers or palm


of the hand, to produce screen-cursor
movement, a spacrball provides six degrees
of freedom.

DTEIT 19/8/

CG-6284

209

INPUT DEVICES
JOYSTICK
A joystick consist of a small, vertical lever
(called the stick) mounted on a base that is
used to steer the screen cursor around.
Joystick select screen positions with actual
stick movement.

DTEIT 19/8/

CG-6284

210

INPUT DEVICES

DATA GLOVE

The glove is constructed with the series of


sensors that detect hand and finger motion.

Electromagnetic
coupling
between
transmitting antennas and receiving antennas is
used to provide information about the position
and orientation of the hand.

DTEIT 19/8/

CG-6284

211

DIGITIZERS

These devices can be used to input coordinate values in


either a two-dimensional or a three dimensional space.

TOUCH PANELS
Touch panel allow displayed objects or screen
positions to be selected with the touch of a finger.

DTEIT 19/8/

CG-6284

212

INPUT DEVICES
IMAGE SCANNERS
Drawing, graphs colour and black and
white photos or text can be stored for
computer processing with an image scanner
by passing an optical scanning mechanism
over the information to be stored.

DTEIT 19/8/

CG-6284

213

INPUT DEVICES

LIGHT PEN
Such pencil-shaped devices are used
to select screen position by detecting
the light coming from points on the
CRT screen.

DTEIT 19/8/

CG-6284

214

INPUT DEVICES

VOICE SYSTEM
The voice system input can be used to
initiate graphics operations or to enter data.
These systems operate by matching an
input against a predefined dictionary of
words and phrases.

DTEIT 19/8/

CG-6284

215

HARD - COPY DEVICES

Printers are the hard copy devices.

These are :
1. IMPACT PRINTERS
2. NON-IMPACT PRINTERS.

DTEIT 19/8/

CG-6284

216

PRINTERS
Most commonly used Hard copy output
device.
Capable of high-quality monochrome i.e.
Single color and multi-color print outs at very
high speed.
Can also produce graphic i.e. Images other
than plain text on the paper.

DTEIT 19/8/

CG-6284

217

IMPACT PRINTERS
IMPACT PRINTERS

DOT MATRIX PRINTERS,

LINE PRINTERS,
DRUM PRINTER,
CHAIN PRINTER,
DAISY WHEEL PRINTER,
PAGE PRINTER.

DTEIT 19/8/

CG-6284

218

IMPACT PRINTERS
Impact printers press formed character
faces against an inked ribbon on to paper
a line printer is a example of impact
device, with the type faces mounted on
bands, chains, drummer wheels.

DTEIT 19/8/

CG-6284

219

IMPACT PRINTERS

DOT MATRIX PRINTER

Dot matrix print head contains rectangular


array of protruding wire pins, with the
number of pins depending on the quality of
printer.

DTEIT 19/8/

CG-6284

220

DOT MATRIX PRINTER


Individual

characters

or

graphics

patterns are obtained by retracing


certain pins so that the remaining
forms the pattern to be printed .

DTEIT 19/8/

CG-6284

221

DOT MATRIX PRINTER

These are bit image impact type of

printers.

Prints the characters and images by

pattern of dots at a speed from 50 to 500


CPS.

DTEIT 19/8/

CG-6284

222

DOT MATRIX PRINTER


Low maintenance, low running expense,
small, lightweight, very efficient at their job
Can print all kind of papers.
Used to print graphs, charts and pictures.
Print the text character by character.

DTEIT 19/8/

CG-6284

223

DOT MATRIX PRINTER

CLASSIFICATION BASED ON
ITS CAPABILITIES
Extremely high volume models used
to print Electricity bills, banks etc.
High Volume models are used for
small business.
Personal model used for Office, Home
users.
DTEIT 19/8/

CG-6284

224

DOT MATRIX PRINTER


9 pin printers are low
cost but with very poor
print quality.
24 pin printers are the
highest
quality
Dot
Matrix Printers.
Expensive as compared
to 9 pin.
DTEIT 19/8/

CG-6284

225

IMPACT PRINTERS
LINE PRINTERS

Allows the entire line to be printed at a


time.
Fully formed character type impact printers.
Provide very high speed output about 15 to
30 pages per minute.

DTEIT 19/8/

CG-6284

226

LINE PRINTERS

Drum Printers are called Line Printers.

These are used for printing the


Electricity and Telephone bills etc.

DTEIT 19/8/

CG-6284

227

LINE PRINTERS
WORKING OF DRUM PRINTERS
A metal drum with all the printable
characters on its periphery is used.
As the drum rotates different letters of the
line gets printed and in one rotation of the
drum all the letter of the line gets printed.

DTEIT 19/8/

CG-6284

228

LINE PRINTERS
First all the letter A in the line will
get printed, next all B, then all the
C and so on until all the letters of the
line is printed.

DTEIT 19/8/

CG-6284

229

PRINTERS
NON-IMPACT PRINTERS

LASER,
INKJET SPRAY,
XEORX PROCESSOR MACHINES,
ELECTROSTATIC,
ELECTEOTHERMAL PRINTERS.

DTEIT 19/8/

CG-6284

230

NON-IMPACT PRINTERS
Non impact printers use laser
techniques,inkjet sprays ,xerographic
processes (as used in photocopying
machines), electrostatic methods and
electro-thermal methods to get images
onto paper.

DTEIT 19/8/

CG-6284

231

NON-IMPACT PRINTERS

LASER PRINTER

In laser printer, laser beam creates a charge


distribution on a rotating drum coated with
photoelectric materials, such as selenium.
Toner is applied to the drum and transfer
paper.

DTEIT 19/8/

CG-6284

232

LASER PRINTERS
A high end printer produces clear and
sharp images.

Provides very fast output up to


16PPM without producing any noise.
Outputs are used for Offset Printing,
Screen Printing and other type printings.

DTEIT 19/8/

CG-6284

233

LASER PRINTERS
Laser Printer can produce 300 to 1800 DPI
resolution.
A cylindrical photo-sensitive drum inside the
Printer is given an even electrostatic charge .
A Laser beam-focused to a tiny spot-scans
across the cylindrical drum from left to right.

DTEIT 19/8/

CG-6284

234

LASER PRINTERS
The area exposed by the LASER beam,
attract a black colored toner to the drum.
Black colored is transferred to the paper
to form the image.

DTEIT 19/8/

CG-6284

235

LASER PRINTERS

The scanning of the drums


surface is usually done by
bouncing the Laser beam off a
multi-sided mirror which rotates
rapidly.

DTEIT 19/8/

CG-6284

236

Printing Process of Laser

DTEIT 19/8/

CG-6284

237

NON-IMPACT PRINTERS

INK-JET PRINTER

Ink jet printers produce output by squirting ink


in horizontal rows across roll of paper wrapped
on a drum.
The electrically charged ink stream is deflected
by an electric field to produce dot matrix
patterns.

DTEIT 19/8/

CG-6284

238

NON-IMPACT PRINTERS
ELECTROSTATIC PRINTERS

An electrostatic device places a


negative charge on paper, one complete
row at a time along the length of paper.
Then the paper is exposed to toner.

DTEIT 19/8/

CG-6284

239

NON-IMPACT PRINTERS
The toner is positively charged and
so is attracted to negatively charged
areas , where it adheres to produce
the specified output.

DTEIT 19/8/

CG-6284

240

PLOTTERS
An output device used to get
hardcopy of information.
Used to produce output such as
drawing in
Architectural and
Engineering applications.

DTEIT 19/8/

CG-6284

241

PLOTTERS
It draws image by using a pen on the
paper surface.

More useful when user requires


graphical outputs.

DTEIT 19/8/

CG-6284

242

PLOTTERS
PLOTTER SIZE
Size of the plotter is fixed according
to maximum size of the paper used.

Actual plotter size may be little


bigger than the paper size used.

DTEIT 19/8/

CG-6284

243

PLOTTERS
TYPES OF PLOTTERS
Single and multiple pen plotters.
Flatbed and drum plotters.
Thermal/laser/pencil plotters.

DTEIT 19/8/

CG-6284

244

PLOTTERS

FLATBED PLOTTER

PEN An actual pen that draws on the plotted paper.

WRITE-MOVE MECHANISM Used to lift and


lower the pen.

X DRIVER MOTOR Moves the pen horizontally


across the paper.

DTEIT 19/8/

CG-6284

245

PLOTTERS
PEN CARTRIDGE
Holds several
different- colored pens . A plotter capable
of multicolor output usually has a
program in read- only memory(ROM) that
instructs the plotter to pickup a new pen
when the programmer requests a color
change.
Y DRIVER MOTOR Moves the pen
vertically across the paper.
DTEIT 19/8/

CG-6284

246

PLOTTERS
DRUM PLOTTER
PEN An actual pen that draws on the plotted paper.
WRITE-MOVE MECHANISM Used to lift and

lower the pen.


Y DRIVER MOTOR Rotates the drum forward and

backward.

DTEIT 19/8/

CG-6284

247

PLOTTERS

PEN CARTRIDGE Holds several different-

colored pens.
# A plotter capable of multicolor
output
usually
has
a program in read- only
memory(ROM) that instructs the plotter to
pickup a new pen when the programmer
requests a color change.

X DRIVER MOTOR
Moves the pen
horizontally across the paper.
DTEIT 19/8/

CG-6284

248

GRAPHICS SOFTWARE
A

general graphics programming


package provides an extensive set of
graphics functions that can be used in a
high level programming language, such as
c or
Fortran GL (graphic library)

DTEIT 19/8/

CG-6284

249

GRAPHICS SOFTWARE
application graphics packages are
designed for non programmers, so that
users can generate display without
worrying about how graphics operation
work.

DTEIT 19/8/

CG-6284

250

GRAPHICS SOFTWARE
ATTRIBUTES

Attributes rare the properties of the output


primitives.

That is an attribute describes how a particular


primitive is to be displayed when changes the size,
position, or orientation of an object within a scene
using geometric transformations.

DTEIT 19/8/

CG-6284

251

GRAPHICS SOFTWARE
Geometric transformations are used to
specify the view that is to be presented
and the portion of the output display area
that is to be used.
Pictures can be subdivided into parts,
called structures or segments or objects,
depending on the software package in use.
DTEIT 19/8/

CG-6284

252

COORDINATE SYSTEM

MODELING
TRANSFORMATIONS

PLOTTER
NORMALIZED
COORDINATES
WORLD
COORDINATES

DTEIT 19/8/

OTHER
OTHEROUTPUT
OUTPUT
DEVICE
COORDINATES

CG-6284

253

COORDINATE REPRESENTATION
We can construct the shape of individual objects
,such as trees or furniture, in a scene within
separate coordinate reference frames called
Modeling coordinates or

Local coordinates.

or

Master coordinates.

DTEIT 19/8/

CG-6284

254

COORDINATE REPRESENTATION

Individual object shapes have been

specified, we can place the objects into


appropriate positions within the scene
using a reference frame called worldcoordinates.

DTEIT 19/8/

CG-6284

255

COORDINATE REPRESENTATION
The world-coordinates description of
the
scene is to one or more output-device reference
frames for display.
These display coordinate system are referred to
as
Device coordinates or

Screen coordinates.

DTEIT 19/8/

CG-6284

256

COORDINATE REPRESENTATION
A graphic system first converts worldcoordinate positions to normalized device
coordinates, in the range from 0 to 1,
before final conversion to specific device
coordinates.

DTEIT 19/8/

CG-6284

257

COORDINATE REPRESENTATION
An initial modeling-coordinate position (x mc,
ymc) Is transferred to a device coordinate
position (xdc, ydc) With the sequence:
(xmc, ymc)->(xwc, ywc)-> (xnc, ync)-> (xdc, ydc)

DTEIT 19/8/

CG-6284

258

COORDINATE REPRESENTATION

The modeling & world-coordinate


positions in this transformation can be any
floating point values :
0<=xnc<=1,
0<=ync<=1,
& The device coordinates are xdc & ydc.

DTEIT 19/8/

CG-6284

259

COORDINATE REPRESENTATION

The basic building blocks for


picture are referred to as output
primitives.

DTEIT 19/8/

CG-6284

260

COORDINATE REPRESENTATION
We carry out the viewing transformation in
several steps --First, we construct the scene in world
coordinates using the output primitives an
attributes.

DTEIT 19/8/

CG-6284

261

COORDINATE REPRESENTATION
Once the viewing reference frame is established ,
we can transform description in world
coordinates to viewing coordinates .We then
define a view port in normalized coordinates .
The final step ,all parts of the picture that lie
outside view port are clipped and the contents of
view port are transferred to device coordinates.

DTEIT 19/8/

CG-6284

262

COORDINATE REPRESENTATION
Next, to obtain a particular orientation for
the window ,we can set up a two
dimensional viewing coordinate system in
the world coordinate plane and define a
window in viewing coordinate system.

DTEIT 19/8/

CG-6284

263

SOFTWARE STANDARDS
The primary goal of standardized graphics
software is portability.
When packages are designed with standard
graphics functions, software can be moved
easily from one hardware system to another
and used in different implementations and
applications.

DTEIT 19/8/

CG-6284

264

SOFTWARE STANDARDS

For
object
modeling
,
color
specifications, surface rendering and picture
manipulations are developed in PHIGS.

A three dimensional GKS extension was


subsequently developed.

DTEIT 19/8/

CG-6284

265

SOFTWARE STANDARDS

This work on standards led to the

development of the graphical kernel system


(GKS).

This system was adopted as the first

graphics

software standard by the

DTEIT 19/8/

CG-6284

266

SOFTWARE STANDARDS

International Standards organization


(ISO) and by various national standards
organizations including the American
national standards institute (ANSI).

DTEIT 19/8/

CG-6284

267

SOFTWARE STANDARDS

Although GKS was originally


designed as a two dimensional graphics
package. A three dimensional GKS
extension was subsequently developed.

DTEIT 19/8/

CG-6284

268

SOFTWARE STANDARDS

The second software standard to be

developed and approved by the standards


organizations was PHIGS (Programmers
Hierarchical

Interactive

Graphics

Standard) which is an extension of gks.

DTEIT 19/8/

CG-6284

269

SOFTWARE STANDARDS

Increased capabilities for object


modeling , color specifications, surface
rendering and picture manipulations
are developed in PHIGS.

DTEIT 19/8/

CG-6284

270

SOFTWARE STANDARDS

Standardization
for device
interface methods is given in the
computer graphics interface (CGI)
system.
And the computer graphics metafile
(CGM) system specifies

DTEIT 19/8/

CG-6284

271

SOFTWARE STANDARDS

Standards for archiving


transporting pictures.

and

Functions
in
graphics
programming packages can be
divided into the following categories:

DTEIT 19/8/

CG-6284

272

SOFTWARE STANDARDS

Output primitives,
Attributes,
Geometric,
Modeling transformations,
Viewing transformations,
Structure operations,
Input functions and
Control operations.

DTEIT 19/8/

CG-6284

273

PROBLEM SOLUTIONS
PROBLEM:- Define analog device, and give
some examples of analog devices.
SOLUTION:- An analog device is a
continuous mechanism that represents
information with continuous physical
variations.
For
Example,
mercury
thermometer and record players are all
analog devices.
DTEIT 19/8/

CG-6284

274

PROBLEM SOLUTIONS
PROBLEM :- Define digital device ,and give
some examples of digital devices.
SOLUTION:- A digital device is a discrete
mechanism which represents all values with a
specific number system. For example, digital
watches and computer all process discrete
information and use the binary number system.

DTEIT 19/8/

CG-6284

275

PROBLEM SOLUTIONS
PROBLEM :-Explain what accuracy means as

related to input devices.

SOLUTION:- Accuracy refers to the


correctness of the data generated by the input
device. For example, if the true temperature
were 72.0031 degrees, and accurate digital
thermometer precise to one degree would read
72 degrees.

DTEIT 19/8/

CG-6284

276

PROBLEM SOLUTIONS
Problem :- What are the major
components of a memory-tube crt ?
Solution :- The major components of
memory-tube CRT are the right gun,
the flooding gun, the collector, the
phosphorous-coated screen, and the
collector ground.

DTEIT 19/8/

CG-6284

277

PROBLEM SOLUTIONS
PROBLEM :-Why is high precision misleading
when combined with low accuracy ?
SOLUTION:- People tend to believe highprecision readings. Assume that we have a
digital thermometer with eight-place precision
that consistently gives readings 9 degrees
higher than the actual temperature.

DTEIT 19/8/

CG-6284

278

PROBLEM SOLUTIONS
PROBLEM:-

What is processor addressing

capacity?
Processor addressing
capacity relates the maximum number
of bytes to which a processor has
access,as determined by the number of
address lines (address width ) the
processor has.

SOLUTION

DTEIT 19/8/

:-

CG-6284

279

It is precise but inaccurate. The user,


however, would be inclined to believe the
reading because of its precision.
for example, assume that the true
temperature is 75.089341 degrees but our
thermometer(which is off by exactly 9
degree) reads 84.089341 degrees. Many
people would be inclined to believe that
the thermometer was correct.
DTEIT 19/8/

CG-6284

280

PROBLEM SOLUTIONS
PROBLEM :- What steps are required to record the

display location where a user is pointing to with a


light pen ?
SOLUTION:- We define the following variables L
and A where :
L=1 if electron beam is striking phosphors at the
light pens location :

DTEIT 19/8/

CG-6284

281

A=address of byte being displayed


when electron beam passes light pen :
If L=1, then store A

DTEIT 19/8/

CG-6284

282

PROBLEM SOLUTIONS

PROBLEM :- Why would not a light pen work


with a liquid crystal display ( LCD) ?
SOLUTION:- An LCD does not need to be
refreshed. Since the display is not changed on a
regular basis, there is nothing for the light pen to
record. Further more , LCDs do not emit a brighter
than usual (or darker than usual) burst the moment a
pixel is turned on , so there is no way to distinguish
which pixel is being turned on and which pixel is
already turned on.
DTEIT 19/8/

CG-6284

283

PROBLEM SOLUTIONS
PROBLEM :- How does a magnetic tablet
system locate the coordinates of the stylus ?
SOLUTION:- The stylus used in a magnetic
tablet system is small radio transmitter. The
tablet is composed of an array of radio
receiver. By measuring the relative strength
of the radio signals at each of the receivers,
you can compute the location of the stylus.
DTEIT 19/8/

CG-6284

284

PROBLEM SOLUTIONS
PROBLEM:- What are some of the disadvantages of
developing a specialize keyboard with commands
printed on the function key ?
SOLUTION :-Printing commands on the function
keys limit flexibility, since any future software
change will require a change of keyboards.
Experience has shown that in most cases a removable
template placed over function keys is just as effective
but less limiting to future development.
DTEIT 19/8/

CG-6284

285

PROBLEM SOLUTIONS

PROBLEM:- Why do computer


graphics systems often use more
than one processor ?
SOLUTION :- Computer graphics
systems often require more than
one
processor
because
the
calculations required for graphics
can overload the main processor
DTEIT 19/8/

CG-6284

286

PROBLEM SOLUTIONS

PROBLEM:- What is display memory


called in a system which has portions
of memory reserved for graphics use
only ?

SOLUTION :- A special area of


memory dedicated to graphics only is
called the frame buffer
DTEIT 19/8/

CG-6284

287

PROBLEM SOLUTIONS
PROBLEM:-

What is processor addressing

capacity?
Processor addressing
capacity relates the maximum number
of bytes to which a processor has
access,as determined by the number of
address lines (address width ) the
processor has.

SOLUTION

DTEIT 19/8/

:-

CG-6284

288

PROBLEM SOLUTIONS

Problem :- What is the function of the control


electrode in a CRT?
Solution:- The control electrode is used to
turn the electron beam on and off.

DTEIT 19/8/

CG-6284

289

PROBLEM SOLUTIONS

Problem :- What is the function of the


electron gun in a CRT ?
Solution:- The electron gun creates a
source of electrons which are focused
into a narrow beam directed at the face
of the CRT.
DTEIT 19/8/

CG-6284

290

PROBLEM SOLUTIONS
Problem :- What cases the electron beam
to move across the screen in regular
pattern in a raster scan CRT ?
Solution:- The deflection yoke which is
connected to the sweep generator creates a
fluctuating
electric
or
magnetic
potential.The change in potential causes
the electron to be deflected.
DTEIT 19/8/

CG-6284

291

PROBLEM SOLUTIONS
Problem :- What is persistence ?

Solution :- Persistence is the term


used to describe the duration of
phosphorescence

exhibited

by

phosphor.

DTEIT 19/8/

CG-6284

292

PROBLEM SOLUTIONS
Problem :- What are some of the more

popular alternatives to the raster scan


CRT ?
Solution :- Plasma displays , LCD ,
memory-tube displays, and randomaccess CRT.
DTEIT 19/8/

CG-6284

293

PROBLEM SOLUTIONS

Problem

:-

WHAT

COMPONENTS

ARE
OF

THE
THE

MAJOR
PLASMA

DISPLAY ?
SOLUTION:- THE MAJOR COMPONENTS OF
A PLASMA DISPLAY ARE THE CATHODES,
ANODES,

GAS

CELLS,

AND

GLASS

PLATES .
DTEIT 19/8/

CG-6284

294

PROBLEM SOLUTIONS
Problem :- WHAT ARE THE MAJOR
COMPONENTS OF AN LCD ?
SOLUTION :- THE MAJOR COMPONENTS
OF AN LCD ARE THE CODUCTIVE
COATING, THE TRANSPARENT PLATE,
THE LIQUID CRYSTAL AND THE
POLARIZED FILM.
DTEIT 19/8/

CG-6284

295

PROBLEM SOLUTIONS
Problem :- What are the major
components of a memory-tube crt ?
Solution :- The major components of
memory-tube CRT are the right gun,
the flooding gun, the collector, the
phosphorous-coated screen, and the
collector ground.

DTEIT 19/8/

CG-6284

296

PROBLEM SOLUTIONS
Problem :- What are the differences
between raster-scan CRT and randomaccess or vector CRT ?
Solution:- Random-access CRT do not
follow
a
regular
scanning
pattern.Instead, the electron beam is
directed from one point to another in
the order in which the points were
DTEIT 19/8/

CG-6284

297

PROBLEM SOLUTIONS
Originally plotted.This method allows
the random-access CRT to present
much better animation than a rasterscan CRT. Memory requirements are
also reduced because a coordinate list
is stored rather than memory map.

DTEIT 19/8/

CG-6284

298

PROBLEM SOLUTIONS
Problem :- What is the major
with random-access CRT

problem

application?

Solution:- When the coordinate data list


becomes too long, the display will began to
flicker.

DTEIT 19/8/

CG-6284

299

PROBLEM SOLUTIONS

Problem :- What type of display


device are plotters similar to ?
Solution:- Memory tube.

DTEIT 19/8/

CG-6284

300

PROBLEM SOLUTIONS
Problem :- WHAT ARE THE MAJOR
COMPONENTS OF AN LCD ?
SOLUTION :- THE MAJOR COMPONENTS
OF AN LCD ARE THE CODUCTIVE
COATING, THE TRANSPARENT PLATE,
THE LIQUID CRYSTAL AND THE
POLARIZED FILM.
DTEIT 19/8/

CG-6284

301

PROBLEM SOLUTIONS`

Problem :- What are the major


components of flatbed plotter?
Solution :- the pen, the write -move
device ,and the x and y driver
motors.
DTEIT 19/8/

CG-6284

302

PROBLEM SOLUTIONS
Problem :- What is the major
difference between a flatbed plotter
and a drum plotter ?
Solution :- The drum plotter moves the
paper to change the y axis. The flatbed
plotter moves the pen.

DTEIT 19/8/

CG-6284

303

PROBLEM SOLUTIONS
There are four steps involve
converting Cartesian coordinates into
a form the computer can understand
these four steps are:

Locate the starting address


corresponding to the line on which the
point is to appear.

DTEIT 19/8/

CG-6284

304


Locate the address of the byte in which
the point will be represented.
Locate the bit which will represent the
correct pixel.
Logically OR the calculated value with
the present value of the byte.

DTEIT 19/8/

CG-6284

305

PROBLEM SOLUTIONS

PROBLEM:- What is the function of

the control electrode in a CRT ?


SOLUTION:- The control electrode is
used to turn the electron beam on and
off.
DTEIT 19/8/

CG-6284

306

PROBLEM SOLUTIONS

PROBLEM:- What is the function of


electron gun in CRT ?
SOLUTION:- The electron gun
creates a source of electrons which are
focused into a narrow beam directed at
the face of CRT.
DTEIT 19/8/

CG-6284

307

PROBLEM SOLUTIONS
PROBLEM :- What causes the electron beam the
move across the screen in a regular pattern in a
raster-scan CRT ?
SOLUTION :- The deflection yoke which is
connected to the sweep generator creates a
fluctuating electric or magnetic potential. The
change in potential causes the electron beam to be
deflected.
DTEIT 19/8/

CG-6284

308

PROBLEM SOLUTIONS

PROBLEM:- What is persistence ?


SOLUTION :- Persistence is the term
used to describe the duration
phosphorescence

exhibited

of

by

phosphor.
DTEIT 19/8/

CG-6284

309

PROBLEM SOLUTIONS

PROBLEM:- What are some of the more


popular alternative to the raster-scan CRT ?
SOLUTION :- Plasma display, LCDs,
memory-tube display, and random-access
CRTs.

DTEIT 19/8/

CG-6284

310

PROBLEM SOLUTIONS

PROBLEM:-

What

are

the

major

components of plasma display?


solution:-The major components of a
plasma display are the cathodes, anodes,gas
cells,and glass plates.

DTEIT 19/8/

CG-6284

311

PROBLEM SOLUTIONS
PROBLEM:- What are
components of an LCD ?

the

major

SOLUTION:-The major components of an


LCD are the conductive coating, the
transparent plate,the liquid crystal,and the
polarized film.
DTEIT 19/8/

CG-6284

312

PROBLEM SOLUTIONS
PROBLEM:- What are the major
components of a memory-tube CRT ?
SOLUTION:- The major components
of a memory-tube CRT are the write
gun, the flooding gun , the collector, the
phosphorus-coated screen , and the
collector ground.
DTEIT 19/8/

CG-6284

313

PROBLEM SOLUTIONS
PROBLEM:- What are the differences
between raster-scan CRTs and random-access
or vector CRTs ?
SOLUTION:- Random-access CRTs do not
follow a regular scanning pattern. Instead, the
electron beam is directed from one point to
another in order in which the points originally
plotted.
DTEIT 19/8/

CG-6284

314

PROBLEM SOLUTIONS
PROBLEM:- What is a major problem with
random-access CRT application ?
SOLUTION:- When the coordinate data list
becomes too long , the display will begin to
flicker.

DTEIT 19/8/

CG-6284

315

PROBLEM SOLUTIONS

PROBLEM:- What types of display device


are plotters similar to ?
SOLUTION :- Memory- tube.

DTEIT 19/8/

CG-6284

316

PROBLEM

:-

What

are

the

major

components of a flatbed plotter ?


SOLUTION :- The pen, the write-move
device, and x and y driver motor.

DTEIT 19/8/

CG-6284

317

PROBLEM SOLUTIONS

PROBLEM :-What is the major difference


between a flatbed plotter and drum plotter ?
SOLUTION :- The drum plotter moves the
paper to change the y axis and The flatbed
plotter moves the pen.
DTEIT 19/8/

CG-6284

318

EXERCISE

List

the

disadvantages

relative
of

advantages
the

major

and
display

technologies for video monitors : vector


refresh systems ,raster refresh systems,DVST
systems and plasma panels.

DTEIT 19/8/

CG-6284

319

EXERCISE

Consider a raster system with resolution of


1024 by 1024.What is the size of the raster
(in bytes) needed to store 4 bits per pixel?
How much storage is required if 8 bits per
pixel are to be stored.

DTEIT 19/8/

CG-6284

320

EXERCISE

Determine the resolution (pixel per


centimeter) in the x and y directions for the
video monitor in use on your system.
Calculate the aspect ratio for this monitor,
and explain how relative proportions of
objects can be maintained on the system.
DTEIT 19/8/

CG-6284

321

EXERCISE

Compare

the

functions

performed

by

display processors in random-scan and in


vector-scan systems.How is the erasure of a
selected section of a screen accomplished in
each of these systems?
DTEIT 19/8/

CG-6284

322

EXERCISE

Discuss the function and working of


various input devices.
Write note on working of output
devices using for graphics applications.

DTEIT 19/8/

CG-6284

323

DTEIT 19/8/

CG-6284

324

OUTPUT PRIMITIVES

POINT PLOTTING,
LINE DRAWING ALGORITHMS#
DDA ALGORITHMS,
#
BRESENHAMS LINE ALGORITHMS,
CIRCLE GENERATING ALGORITHMS,
ELLIPSES,
ATTRIBUTES AND
CONSTRUCTION TECHNIQUES.
DTEIT 19/8/

CG-6284

325

OUTPUT PRIMITIVES
POINTS AND LINES,
LINE-DRAWING ALGORITHMS,

a. DDA-ALGORITHAM,
b. BRESENHAMS LINEALGORITHAM,
CIRCLE GENERATING ALGORITHAM,
MIDPOINT CIRCLE ALGORITHAM,
ELLIPSE GENERATING ALGORITHAMS,
MIDPOINT ELLIPSE ALGORITHAM.

DTEIT 19/8/

CG-6284

326

POINTS & LINES


POINTS AND LINES

Point

plotting is accomplished by
converting a single coordinate position
furnished by an application program into
appropriate operation for the output device
in use.
y
point

DTEIT 19/8/

CG-6284

327

POINTS & LINES


A random-scan (vector) system stores pointplotting instructions in the display list ,
Coordinate values in these instructions are
converted to deflection voltages that position
the electron beam at the screen locations to be
plotted during each refresh cycle.

DTEIT 19/8/

CG-6284

328

POINTS & LINES


For a black and white raster system,
on the other hand , a point is plotted by
setting the bit value corresponding to a
specified screen position within the
frame buffer to 1.

DTEIT 19/8/

CG-6284

329

POINTS & LINES

Line

drawing is accomplished by calculating


intermediate positions along the line path between
two specified end-point positions.
y

line

endpoints

x
DTEIT 19/8/

CG-6284

330

POINTS & LINES

An output device is then directed to fill in

these positions between the endpoints.

For analog devices , such as a vector pen

plotter or a random-scan display, a straight line


can be drawn smoothly from one endpoint to the
other.
DTEIT 19/8/

CG-6284

331

LINE

Digital devices display a straight line


segment by plotting discrete points between
the two endpoints.
A computed line position of (10.48,20.51),
for example , would be converted to pixel
position (10,21).this rounding of coordinate
values to integers causes lines to be displayed
with a stairstep appearance (the jaggies)

DTEIT 19/8/

CG-6284

332

STAIRSTEP EFFECT (JAGGIES) PRODUCED


WHEN A LINE IS GENERATED AS A SERIES
OF PIXEL POSITIONS.

DTEIT 19/8/

CG-6284

333

LINE

The characteristics stairstep shape of


raster lines is particularly noticeable on systems
with low resolution.

We can improve their appearance somewhat


by displaying them on high resolution systems.

More effective techniques for smoothing


raster lines are based
on adjusting pixel
intensities along the line paths.
DTEIT 19/8/

CG-6284

334

LINE
We will assume that pixel positions are of
referenced according scan line number and
column number ( pixel position across a scan
line ).

This addressing scheme is illustrated in


figure.Scan lines are numbered consecutively
from 0, starting at the bottom of the screen;
and pixel columns are numbered from 0, left
to right across each scan line.
DTEIT 19/8/

CG-6284

335

POINTS AND LINES


To load an intensity value into the
frame buffer at a position corresponding
to column x along scan line y, we will
assume we have available a low-level
procedure of the form :

setpixel (x, y, intensity)


DTEIT 19/8/

CG-6284

336

SCAN LINE NUMBER

5
4
3
2
1
0

PIXEL COLUMN
NUMBER

PIXEL POSITION REFERENCED BY SCANLINE NUMBER AND COLUMN NUMBER.


DTEIT 19/8/

CG-6284

337

POINTS AND LINES

Pixel position referenced by scan-

line number and column number.

We sometimes will also want to be

retrieve
intensity

the

current

setting

for

frame-buffer
a

specified

location.
DTEIT 19/8/

CG-6284

338

LINE-DRAWING ALGORITHMS
Line-drawing algorithms are the cartesian
slope-intercept equation for a straight line is
y = m.x+b
-----(1)
with m representing the slope of the line
and
b as the y intercept.
Given that the two endpoints of a line
segment are specified at position (x1, y1)
and (x2, y2).
DTEIT 19/8/

CG-6284

339

We can determine values for


the slope m and y intercept b
with the following calculations
:

y2

y1

m=(y2 - y1) / (y2 - y1) --(2)


b = y1 - m.x1 ----(3)

Algorithms for displaying


straight lines lines are
based on the line and the
calculation
DTEIT 19/8/

CG-6284

x1

x2

Line path between


endpoints (x1,y1)
and (x2,y2)

340

LINE-DRAWING ALGORITHMS
For any given x interval along a line ,we can
compute the corresponding y interval
from :
y=m. x -----(4)
Similarly, we can obtain the x interval x
corresponding to a specified y as
x =y/m -----(5)
These equations form the basis for determining
deflection voltages in analog device.

DTEIT 19/8/

CG-6284

341


For lines whose slopes have
magnitude
|m|<1 , x can be set
proportional to a small horizontal
deflection
voltage
and
the
corresponding vertical deflection is
then set proportional to y.
For lines whose slopes have
magnitudes |m| > 1 , y can be set
proportional to a small vertical
deflection voltage set proportional to
x.
DTEIT 19/8/

CG-6284

342

LINE-DRAWING ALGORITHMS
Y2

Y1

X1

X2

STRAIGHT LINE SEGMENT WITH FIVE SAMPLING


POSITIONS ALONG THE X AXIS BETWEEN X1 & X2.
DTEIT 19/8/

CG-6284

343

DDA - ALGORITHM
The digital differential analyzer (dda) is
a scan-concersion line algorithm
based
on calculating either y or x using
equation

y=m x
x= y/m
DTEIT 19/8/

CG-6284

344

DDA - ALGORITHM

We sample the line at unit intervals in


one coordinate and determine corresponding
integer values nearest the line path for the
other coordinate.
If the slope is less than or equal to 1, we
sample at unit x intervals(x=1) and
compute each successive y value as
Yk+1=yk+m -----(6)
DTEIT 19/8/

CG-6284

345

DDA - ALGORITHM
Subscript k takes integer value starting
from 1,for the first point and increases by
one until the final endpoint is reached.
Since m can be any real number between 0
& 1, the calculated y values must be
rounded to the nearest integer.

DTEIT 19/8/

CG-6284

346

DDA - ALGORITHM

For lines with a positive slope greater


than one, we reserve the roles of x and
y. That is we sample at unit y
intervals(dy=1) and calculate each
succeeding x value as:
Xk+1=xk+1/m ------(7)
Equation 6 and 7 are based on the
assumption that the lines are to be
processed from the left endpoint to the
right endpoint.
DTEIT 19/8/

CG-6284

347

DDA - ALGORITHM
If this processing is reversed , so that the
starting point is at right, then either we have dx
= -1and

Yk+1=yk-m -----(8)
Xk+1=xk-1/m -----(9)
These two equations can be used to calculate
pixel positions along a line with negative slope.

DTEIT 19/8/

CG-6284

348

DDA - ALGORITHM
If the absolute value of slope is less than one
and the start endpoint is at left, we set x=1
and calculate y values.
When the start endpoint is at right we set x=
-1 and obtain y positions.
When the absolute value of a negative slope is
greater than one we use y=-1.
DTEIT 19/8/

CG-6284

349

DDA - ALGORITHM
Procedure line DDA.(Xa,ya,xb,yb : integer
var
dx, dy, steps, k : integer;
xinctrment, yincrement, x, y: real;
begin
dx := xb - xa ; dy := yb - ya;
if abs(dx)>abs(dy) then steps :=abs(dx)
DTEIT 19/8/

CG-6284

);

350

DDA - ALGORITHM

Else steps :=abs(dy);


xincrement : = dx / steps;
Yincrements := dy / steps;
x := xa;
Y :=ya;
setpixel (round(x), round(y), 1);
For k :=1 to steps do
Begin
x := x + x increment; y:=y increment;
Set pixel (round (x), round (y) , 1)
end
end; ( line DDA)

DTEIT 19/8/

CG-6284

351

ABOUT DDA ALGORITHM


The dda algorithm is faster method for
calculating pixel positions.
It eliminates the multiplication by making use of
raster characteristics .
The accumulation of round off error in successive
addition of the floating point increment can cause
the calculated pixel positions to drift away from
the true line path for long line segments.

DTEIT 19/8/

CG-6284

352

The rounding operations and floating point


arithmetic in procedure line dda are still
time consuming.
We can improve the performance of dda
algorithm
By separating the increments m and 1/m
into integer and fractional parts so that all
calculations are reduced to integer
operations.
DTEIT 19/8/

CG-6284

353

BRESENHAMS LINE ALGORITHM


An accurate and efficient raster line generating
algorithm scan converts lines using only
incremental integer calculations that can be
adapted to display circles and other curves.
Bresenhams line algorithm by testing the sign of
an integer parameter, whose value is proportional
to the difference between the separations of the
two pixel positions from the actual line of path.

DTEIT 19/8/

CG-6284

354

BRESENHAMS LINE ALGORITHM


To illustrate Bresenhams approach, we
first consider the scan conversion process
for lines with positive slope less than one.
Pixel position along a line path and than
determined by sampling at unit x intervals.

DTEIT 19/8/

CG-6284

355

BRESENHAMS LINE ALGORITHM

Starting from the left end point (x0,y0)

of a given line we step to each successive


column(x position) and

Plot the pixel whose scan line y value is

closest to the line path.

DTEIT 19/8/

CG-6284

356

BRESENHAMS LINE ALGORITHM


Assuming we have determined that the
pixel at (xk,yk) is to be displayed,
we next need to decide which pixel to
plot in the column xk+1.

our choices are the pixels at positions


(xk+1,yk) and (xk+1,yk+1).

DTEIT 19/8/

CG-6284

357

BRESENHAMS LINE ALGORITHAM


At sampling position

Y k+1

xk+1, we label vertical pixel

d1

yk

separations from the path as


d1 and d2.

d2

x k+1
DISTANCES
BETWEEN
PIXEL POSITIONS AND
THE LINE y COORDINATE
AT SAMPLING POSITION

xk+1

DTEIT 19/8/

CG-6284

358

BRESENHAMS LINE ALGORITHM


The y coordinate on the mathematical line at pixel

column position xk+1, is calculated as


Y=m(xk+1)+b
then
d1= y-yk = m(xk+1)+b - yk
and d2= (yk+1)-y = (yk +1) - m(xk+1)-b

The difference between these two separations is


d1-d2=2m(xk+1) -2 yk +2b - 1

DTEIT 19/8/

CG-6284

359

BRESENHAMS LINE ALGORITHM


m=Ay/Ax,
Where ay and ax are the ertical and
horizontal separations of the end point positions pk=ax(d1-d2)
= 2ay.Xk-2ax.Yk+c
The sign of pk is the same as the sign of
d1-d2 , since x>0 for our example. Parameter c is
constant and the value 2dy+ x(2b-1), which is
independent pixel at Yk is closer to the line path
than the pixel at Yk+1,
DTEIT 19/8/

CG-6284

360

BRESENHAMS LINE ALGORITHM


then decision parameter pk is negative . In that
case, we plot the lower pixel; otherwise we
plot the upper pixel.
So,

Pk+1=2ay.Xk+1 - 2ax.Yk+1 + c

pk+1=pk + 2ay - 2ax(yk+1 - yk)


at the starting pixel position (x0,y0) and
with m evaluated as ay/ax :
p0=2ay-ax
DTEIT 19/8/

CG-6284

361

BRESENHAMS LINE ALGORITHAM


1. Input

the two line endpoints and store the left


endpoint in (x0,y0)

2. Load (x0,y0) into the frame buffer,that is ,plot


the first point.
3.Calculate constants x , y , 2y and 2y-2x and
obtain the starting value for the decision
parameters p0 = 2y-x
DTEIT 19/8/

CG-6284

362

BRESENHAMS LINE ALGORITHAM


4.

At each Xk along the line,starting at k = 0,


perform the following test: If Pk<0.the next
point to plot is(Xk + 1,Yk)and Pk + 1 = Pk +
2y otherwise the next point to plot is (Xk +
1, YK + 1)and pk + 1 = Pk + 2y - 2x

5. Repeat step 4 x times.

DTEIT 19/8/

CG-6284

363

LOADING THE FRAME BUFFER

The straight line segments and other

objects are scan converted for display with


a raster system, frame-buffer positions must
be calculated.
Scan conversion algorithms generate pixel
positions at successive unit intervals.
DTEIT 19/8/

CG-6284

364

LOADING THE FRAME BUFFER


As a specific example, suppose the frame

buffer array is addressed in rowmajor order and


that pixel positions vary from (0,0) at the lower
left screen corner to (xmax, ymax) at the top right
corner.
DTEIT 19/8/

CG-6284

365

LOADING THE FRAME BUFFER


For a bilevel system ( 1 bit per pixel), the
frame-buffer

bit address for pixel

position(x,y) is calculated as :
addr(x,y)=addr(0,0)+y(xmax+1)+x
Moving across a scan line, we can calculate
the frame-buffer address for the pixel at
DTEIT 19/8/

CG-6284

366

LOADING THE FRAME BUFFER


Stepping diagonally up to the next scan
line from(x,y), we get (x+1,y) as the
following offset from the address for
position (x,y) :

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

DTEIT 19/8/

CG-6284

367

LOADING THE FRAME BUFFER


To the frame-buffer address of (x+1,y+1)
with the calculation :
addr(x+1,y+1)=addr
(x,y)+xmax+2
Where the constant xmax+2 is
precomputed once for all line segments.

DTEIT 19/8/

CG-6284

368

LOADING THE FRAME BUFFER


Similar incremental calculation can be
obtained.
For unit steps in the negative x and y
screen directions.Each of these address
calculation involves only a single integer
addition.

DTEIT 19/8/

CG-6284

369

GENERATING
ALGORITHAM CIRCLE

PROPERTIES OF CIRCLE : A circle is defined as the set


of points that are all at a given distance r from a
center.Position(xc,yc) this distance relationship is expressed by
the pythagorean theorem in cartesian coordinates

(x - xc)^2 +

(y-yc)^2 = r^2.We could use this equation to calculate the


position of points on a circle circumference by stepping along
the x axis in unit steps from xc - r to xc + r and calculating the
corresponding y values at each position .
DTEIT 19/8/

CG-6284

370

MIDPOINT ALGORITHM
To apply the midpoint method
we define the circle function .

yk
yk-1

X 2+ y2 - r2 = 0
Midpoint

xk

fcircle(x,y) = x^2 + y^2 - r^2


fcircle(x, y) <0, if (x,y) is inside
the circle boundary.
DTEIT 19/8/

CG-6284

yk+1

yk+2

MIDPOINT
BETBEEN
CANDIDATE PIXELS AT
SAMPLING POSITION
xk+1
ALONG
A
CIRCULAR PATH

371

MIDPOINT CIRCLE
ALGORITHAM
1. Input radius r and circle center (xc, yc) and obtain
the first point on the circumference of a circle
centered on the origin as
(x0,y0) = (0,r)
2.

Calculate the initial value of the


parameter as

decision

p0=5/4 - r

DTEIT 19/8/

CG-6284

372

MIiDPOINT CIRCLE ALGORITHAM


3. At each xk position,starting at k=0 perform the following test:if
pk>0,the next point along the circle centered on (0,0)is (x k +1,yk) and
pk +1 = pk + 2xk+1 +1
Otherwise the next point along the circle is
(Xk +1, yk - 1) and
P k+1 = pk + 2xk+1 -2yk+1

DTEIT 19/8/

CG-6284

373

MIiDPOINT CIRCLE ALGORITHAM


4. Determine symmetry points in the other seven

octants.
5. Move each calculated pixel position (x, y)
onto the circular path centered on (xc, yc)and
plot the coordinate values:
x=x+xc, y=y+yc
6. Repeat step 3 through 5 until x>=y
DTEIT 19/8/

CG-6284

374

ELLIPSE-GENERATING ALGORITHMS
PROPERTIES OF ELLIPSES :
An ellipse is defined as the set of points such that the sum
of the distances from two fixed positions (foci) is the same for
all points. If the distances to the two foci from any point p=(x,
y) on the ellipse are labeled d1 and d2, then the general
equation of an ellipse can be stated as
d1+d2=constant

DTEIT 19/8/

CG-6284

375

ELLIPSE-GENERATING ALGORITHMS
expressing distances d1 and d2 in terms of the focal coordinates
f1=(x1,y1)andf2=(x1,y2),we have
((X-x2)^2+(y-y1)^2 + (x-x2)^2+(y-y2)^2)^1/2= constant. The
general ellipse equation in the form
X^2+by^2+cxy+dx+ey+f=0
Expressing distances d1 and d2 in terms of the focal coordinates
f1=(x1,y1) and f2=(x1,y2),

DTEIT 19/8/

CG-6284

376

ELLIPSE-GENERATING ALGORITHMS
we have
y
F1

d1

F2 d2

p=(x,y)

ELLIPSE GENERATED
ABOUT FOCI F1 AND F2

((x-x2)^2+(y-y1)^2 + (x-x2)^2+(y-y2)^2)^1/2= CONSTANT

DTEIT 19/8/

CG-6284

377

ELLIPSE-GENERATING ALGORITHMS

Symmetry of an ellipse.
(-x,y)

ry (x,y)

(x,y)

rx
(-x,-y)

Calculation of a point

(x,-y)

in

one

quadrant

yields the ellipse points


shown for the other three
quadrants.

DTEIT 19/8/

CG-6284

378

ELLIPSE-GENERATING ALGORITHMS

The equation of the ellipse can be written in terms of the


ellipse center coordinates and parameters rx and ry as
(x-xc) / rx)^2 + (y-yc / ry)^2 = 1
using polar coordinates r and theta. We can also describe
the ellipse in standard position with parametric_equations:
x = xc+rxcos(theta) ;
y = yc +rysin(theta)

DTEIT 19/8/

CG-6284

379

ELLIPSE-GENERATING ALGORITHMS

ry

rx
yc
xc

We define an ellipse function with (xc,yc)=(0,0) as

fellipse(x,y)= ry^2.X^2 + rx^2.Y^2 - rx^2.Ry^2

DTEIT 19/8/

CG-6284

380

ELLIPSE-GENERATING ALGORITHMS
Which has the following properties:
Fellipse(x,y) {<0, if(x,y)is inside the
ellipse boundary

{=0 if (x,y)is on the


ellipse boundary
{>0 if (x,y)is outside

ellipse boundary

DTEIT 19/8/

CG-6284

381

Midpoint Ellipse Algorithm


1. Input rx,ry,and ellipse center (xc,yc), and obtain the first point on
an ellipse centered on the origin as
(X0,y0)=(0,ry)
2. Calculate the initial value of the decision parameter in region 1 as
P10=ry^2-rx^2ry+1/4rx^2

DTEIT 19/8/

CG-6284

382

Ellipse
Algorithm
3. AtMidpoint
each xk position
in region
1, starting at k=0,
perform the following test: if p1k<0, the next point
along the ellipse centered on (0,0) is (xk+1, yk) and
P1k+1=p1k+2ry^2xk+1+ry^2
Otherwise,next point along the circle is (xk+1,yk-1)
and p1k+1=p1k + 2ry^2xk+1 -2rx^2yk+1 + ry^2

DTEIT 19/8/

CG-6284

383

Midpoint Ellipse Algorithm


with

2ry^2xk+1= 2ry^2xk + 2ry^2 ,

2rx^2yk+1 = 2rx^2yk - 2rx^2

4. Calculate the initial value of the decision parameter in region


2 using the last point (x0,y0) calculated in region 1 as
P20=ry^2(x0+1/2)^2 + rx^2(y0-1)^2-rx^2ry^2

DTEIT 19/8/

CG-6284

384

Midpoint Ellipse Algorithm


ry^2x^2+rx^2y^2-rx^2ry^2=0

yk
midpoint

yk+1
xk

xk+1

5. At each yk position in region 2,starting at k=0,


perform the following test : if p2k>0, the next

DTEIT 19/8/

CG-6284

385

Midpoint Ellipse Algorithm


Point along the ellipse centered on (0,0)is (xk,yk-1) and
p2k+1=p2k - 2r^2xyk+1 + r^2x
Otherwise, the next point along the circle is
&

(xk+1,yk-1)

p2k+1= p2k+ 2r^2yxk+1 - 2r^2xyk+1 + r^2x


Using the same incremental calculations for x and y as in
region

DTEIT 19/8/

CG-6284

386

Midpoint Ellipse Algorithm


6.

Determine symmetry points in the other three


quadrants.

7. Move each calculated pixel position(x,y) onto the


elliptical path centered on(xc,yc) and plot the
coordinate values:
X = x +xc,

y = y+yc

8. Repeat the steps for region 1 until 2ry^2x >=


2rx^2y.
DTEIT 19/8/

CG-6284

387

MIDPOINT ELLIPSE DRAWING


Given input parameters rx=8 & ry=6.Initial
values & increments for the decision parameter
calculations are :
2ry2x=0 (with increment 2ry2=72)
2rx2y=0

(with increment 2rx2=-128)

DTEIT 19/8/

CG-6284

388

MIDPOINT ELLIPSE DRAWING


For region 1: the initial point for the ellipse
centered on the origin is (x0,y0)=(0, 6) &
the initial decision parameter value is
P10 = ry2 - rx2 ry + 1/4 rx2 = -332

DTEIT 19/8/

CG-6284

389

MIDPOINT ELLIPSE DRAWING

Successive decision parameter values &

Positions along the ellipse path are calculated

using the midpoint method as :

DTEIT 19/8/

CG-6284

390

p1k

(xk+1, yk+1)

0
1
2
3
4
5
6

-332
-224
-44
208
-108
288
244

(1,6)
(2,6)
(3,6)
(4,5)
(5,5)
(6,4)
(7,3)

DTEIT 19/8/

2ry2 xk+1

2rx2 yk+1

72
144
216
288
360
432
504

768
768
768
640
640
512
384

CG-6284

391

MIDPOINT ELLIPSE DRAWING


We now move out of region 1, since
2ry2 x > 2rx2 y.

For region 2, the initial point is


(x0,y0)=(7, 3) & the initial decision
parameter is
P20= f(7 + 1/2, 2) = -151.

DTEIT 19/8/

CG-6284

392

THE REMAINING POSITIONS ALONG THE


ELLIPSE PATH IN THE FIRST QUARDANT
ARE THEN CALCULATED AS :
k p1k
0 -151
1 233
2 745
DTEIT 19/8/

(xk+1, yk+1)
(8,2)
(8,1)
(8,0)

2ry2 xk+1

2rx2 yk+1

576 256
576 128
--CG-6284

393

MIDPOINT ELLIPSE DRAWING

A plot of the selected positions around the ellipse boundary


with in the first quadrant is shown in figure :

DTEIT 19/8/

CG-6284

394

6
5
4
3
2
1
0
0 1 2 3 4 5 6 7 8

POSITIONS ALONG ELLIPTICALPATH CENTERED


ON THE ORIGIN WITH rx=8, ry=6 USING THE
MIDPOINT ALGORITHM TO CALCULATE PIXEL
ADDRESSES IN THE FIRST QUADRANT.
DTEIT 19/8/

CG-6284

395

MIDPOINT ELLIPSE DRAWING


(Program in pascal)

Procedure ellipse midpoint (xcenter, ycenter, rx, ry :


integer);
Var
p, px, py, x ,y : integer;
Ry2, rx2, tworx2, twory2 : integer;
Procedure plotpoints ;
begin

DTEIT 19/8/

CG-6284

396

MIDPOINT ELLIPSE DRAWING


Setpixel (xcenter + x, ycenter + y, 1);
Setpixel (xcenter - x, ycenter + y, 1);
Setpixel (xcenter + x, ycenter - y, 1);
Setpixel (xcenter - x, ycenter - y, 1)
End;
{plotpoints}
Begin
Ry2 := ry * ry;
Rx2 := rx * rx;

DTEIT 19/8/

CG-6284

397

MIDPOINT ELLIPSE DRAWING

Twory2 := 2* ry2;
Tworx2 := 2* rx2;
{ Region 1 }
x := 0;
Y := ry;
Plotpoints;
P :=round ( ry2 - rx2 * ry + (0.25* rx2));
Px :=0;

DTEIT 19/8/

CG-6284

398

MIDPOINT ELLIPSE DRAWING


Py := tworx2 * y;
While px < py do
Begin
X:= x + 1;
Px := px + twory2;
If p >= 0 then
Begin
Y := y-1

DTEIT 19/8/

CG-6284

399

MIDPOINT ELLIPSE DRAWING


Py := py - tworx2
End;
If p < 0 then
P := p+ ry2 + px
Else
p := p+ ry2 + px - py;
Plotpoints
End;

{ region 2 }

DTEIT 19/8/

CG-6284

400

MIDPOINT ELLIPSE DRAWING


P:= round ( ry2 * ( x + 0.5) * ( x + 0.5)+
* ( y-1) - rx2 * ry2);

rx2* (y - 1)

while y > 0 do
Begin
Y := y -1;
Py := py - tworx2;
If p <= 0 then
begin

DTEIT 19/8/

CG-6284

401

MIDPOINT ELLIPSE DRAWING


X := x + 1;
Px := px + twory2
End;
If p>0 then
p := p+ rx2 - py
Else
p:= p + rx2 -py + px;
Plotpoints
End;
End;
{ ellipsemidpoint }
DTEIT 19/8/

CG-6284

402

ATTRIBUTES
Any parameter that affects the way a
primitive is to be displayed is referred to as
an attribute parameter.
Some attribute parameters, such as color &
size , determine the fundamental
characteristics of a primitive.
DTEIT 19/8/

CG-6284

403

ATTRIBUTES
Others specified how the primitive is to be
displayed under special conditions.
Example of attributes in this class include
depth information for 3-d viewing &
visibility or detectability options for
interactive object selection programs
DTEIT 19/8/

CG-6284

404

ATTRIBUTES
Attributes that control the basic

display properties of primitives ,


without regard for special situations.
Lines can dotted or dashed, fat or
thin, & blue or orange.
DTEIT 19/8/

CG-6284

405

ATTRIBUTES
Areas might be filled with one color

or with amulticolor pattern.


Text can appear reading from left to
right, slanted diagonally across the
screen, or in vertical columns.
DTEIT 19/8/

CG-6284

406

ATTRIBUTES
Individual character can be displayed

in different fonts, colors, & sizes.

DTEIT 19/8/

CG-6284

407

LINE ATTRIBUTES
Basic attributes of a straight line segment

are its type, its width, & its color.


In some graphics packages, lines can also
be displayed using selected pen or brush
options.

DTEIT 19/8/

CG-6284

408

LINE TYPE
Possible selections for the line type
attribute include solid lines, dashed lines &
dotted lines.
We modify a line -drawing algorithm to
generate such lines by setting the length &
spacing of displayed solid.
DTEIT 19/8/

CG-6284

409

LINE TYPE
That is equal to the length of the solid
sections along the line path.
A dashed line could be displayed by
generating an interdash spacing sections.

DTEIT 19/8/

CG-6284

410

LINE TYPE
Both the length of the dashes & the
interdash spacing are often specified as user
options.
A doted line can be displayed by
generating very short dashes with the
spacing equal to or greater than the dash.
DTEIT 19/8/

CG-6284

411

LINE TYPE
Size, similar methods are used to produce
other line type variations.
To set line type attributes in a phigs
application program, a user invokes the
function.
Setlinetype(it)
Where parameter it is
DTEIT 19/8/

CG-6284

412

LINE TYPE
Setlinestyle

Sets the current line style and width or


pattern

Declaration:
Void far setlinestyle(int linestyle, unsigned
upattern, int thickness);
DTEIT 19/8/

CG-6284

413

LINE TYPE
Remarks:
Setlinestyle sets the style for all lines drawn
by line, lineto, rectangle,
Drawpoly, etc.
Return value : if invalid input is passed to
setlinestyle, graphresult returns -11, and the
Current line style remains unchanged.
DTEIT 19/8/

CG-6284

414

LINE TYPE
Example:
#Include <graphics.H>
#Include <stdlib.H>
#Include <string.H>
#Include <stdio.H>
#Include <conio.H>
/* The names of the line styles supported */
Char *lname[] = {
"solid_line",

DTEIT 19/8/

CG-6284

415

LINE TYPE
"Dotted_line",
"Center_line",
"Dashed_line",
"Userbit_line"
};
Int main(void)
{
/* request auto detection */

DTEIT 19/8/

CG-6284

416

LINE TYPE
Int gdriver = DETECT, gmode;
Int style, midx, midy, userpat;
Char stylestr[40];
/* Initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
midx = getmaxx() / 2;
Midy = getmaxy() / 2;
/* A user defined line pattern */
/* binary: "0000000000000001" */
userpat = 1;
DTEIT 19/8/

CG-6284

417

LINE TYPE
For (style=solid_line; style<=userbit_line; style++)
{
Setlinestyle(style, userpat, 1);
/* Convert style into a string */
strcpy(stylestr, lname[style]);
/* Draw a line */
line(0, 0, midx-10, midy);
/* Draw a rectangle */

DTEIT 19/8/

CG-6284

418

LINE TYPE
rectangle(0, 0, getmaxx(), getmaxy());
/* Output a message */
outtextxy(midx, midy, stylestr);
/* Wait for a key */
getch();
Cleardevice();
}
/* Clean up */
closegraph();
Return 0;
}

DTEIT 19/8/

CG-6284

419

LINE WIDTH
Implementation of line width options
depends on the capabilities of the output
device.
A heavy line on a video monitor could be
displayed as adjacent parallel lines , while a
pen plotted might require pen changes.
DTEIT 19/8/

CG-6284

420

LINE WIDTH
We set the line width attribute with the
command :
Setlinewidthscalefactor (lw)
Linewidth parameter lw is assigned a
positive no to indicate the relative width of
the line to be displayed.
DTEIT 19/8/

CG-6284

421

LINE WIDTH
A value of one specifies a standard width
line.
On a pen plotter, for instance, a user could
set lw to value of 0.5 to plot a line whose
width is half that of the standard line.
DTEIT 19/8/

CG-6284

422

LINE WIDTH
Values grater than 1 produce lines thicker
than the standard.
For raster implementation, a standard width
line is generated with single line pixels at
each sample position, as in the bresenham
algorithm.
DTEIT 19/8/

CG-6284

423

LINE WIDTH
Other width lines are dirplaed as positive
integer multiples of the standard line by plotting
additional pixels along adjacent parallel line
paths.
For lines with slope magnitude less than 1, we
can modify a line drawing routine to display
thick lines by plotting a vertical span of pixels at
each x positions along the line.

DTEIT 19/8/

CG-6284

424

LINE WIDTH
We plot a double width line by generating a
parallel line above the original line path.
For lines with slope magnitude greater than
1, we can plot thick lines with horizontal
spans, alternately picking up pixels to the
right & left of the line path.

DTEIT 19/8/

CG-6284

425

LINE WIDTH
Another problem with implementing width
options using horizontal or vertical pixel
spans is that the method produce lines
whose ends are horizontal or vertical
regardless of the slope of the line.

DTEIT 19/8/

CG-6284

426

LINE WIDTH
This effect is more noticeable with very
thick lines.
We can adjust the shape of the line ends to
give them a better appearance by adding
line caps.
DTEIT 19/8/

CG-6284

427

LINE WIDTH

One kind of line cap is the butt cap


obtained by adjusting the end positions of
the component parallel lines so that the
thick line is displayed with square ends that
are perpendicular to the line path.

DTEIT 19/8/

CG-6284

428

LINE WIDTH
Another line cap is the round cap obtained
by adding a filled semicircle to each butt cap.
The circular arcs are centered on the line
endpoints & have a diameter equal to the line
thickness.
A third type of line cap is the projective
square cap.

DTEIT 19/8/

CG-6284

429

LINE WIDTH
Other methods for producing thick lines
include displaying the line as a filled
rectangle or generating the line with a
selected pan or brush pattern.

DTEIT 19/8/

CG-6284

430

LINE WIDTH

DOUBLE WIDE RASTER LINE WITH SLOPE |m|<1


GENERATED WITH VERTICAL PIXEL SPANS

DTEIT 19/8/

CG-6284

431

LINE WIDTH

RASTER LINE WITH SLOPE |m|>1 & LINE WIDTH PARAMETER


lw=4PLOTTED WITH HORIZONTAL PIXEL SPANS

DTEIT 19/8/

CG-6284

432

LINE WIDTH
Displaying thick lines using horizontal &
vertical pixel spans, for example, leaves
pixel gaps at the boundaries between lines
of different slopes where there is a shift
from horizontal spans to vertical spans.
DTEIT 19/8/

CG-6284

433

LINE WIDTH
We can generate thick polylines that are
smoothly joined at the cost of additional
processing at the segment end points.

DTEIT 19/8/

CG-6284

434

LINE WIDTH
Three possible methods for smoothly joining

two line segments.


Miter join : is accomplished by extending

the outer boundaries of each of the two lines


until they meet.

DTEIT 19/8/

CG-6284

435

LINE WIDTH

Round join: is produced by capping the

connection between the two segments with a


circular boundary whose diameter is equal to the
line width.
Bevel join : is generated by displaying the line
segments with butt caps & filling in the
triangular gap where the segments meet.
DTEIT 19/8/

CG-6284

436

MITER JOIN

DTEIT 19/8/

ROUND JOIN

CG-6284

BEVEL JOIN

437

PEN & BRUSH OPTIONS


With some packages, lines can be displayed
with pen or brush selections.
Options in this category include shape, size &
pattern.
These shapes can be stored in a pixel mask
that identifies the array of pixel positions that
are to be set along the line path.
DTEIT 19/8/

CG-6284

438

PEN & BRUSH OPTIONS


A rectangular pen can be implemented with the mask
shown by moving the center of the mask along the line
path.
Lines generated with pen shapes can be displayed in
various widths by changing the size of the mask.For
example, the rectangular pen line could be narrowed
with a 2 x 2 rectangular mask or widened with a 4 x 4
mask .

DTEIT 19/8/

CG-6284

439

PEN & BRUSH OPTIONS


Lines can be displayed with selected
patterns by superimposing the pattern
values on to the pen or brush mask .
An additional pattern option that can be
provided in a paint package is the display of
simulated brush strokes.

DTEIT 19/8/

CG-6284

440

LINE COLOR
When a system provides color (or
intensity) options, a parameter giving the
current color index is included in the list of
system- attribute values.

DTEIT 19/8/

CG-6284

441

LINE COLOR
A polyline routine displays a line in the
current color by setting this color value in
the frame buffer at pixel locations along the
line path using the set pixel procedure.

DTEIT 19/8/

CG-6284

442

LINE COLOR
The number of color choices depends upon
the no. Of bits available per pixel in the
frame buffer.
We set the line color value in phigs with
the function :
Setpolylinecolourindex (lc).
DTEIT 19/8/

CG-6284

443

LINE COLOR
Nonnegative integer values, corresponding
to allowed color choices, are assigned to the
line color parameter lc.
A line drawn in the background color is
invisible, & user can erase a previously line
by sespecifying it in the background color.
DTEIT 19/8/

CG-6284

444

LINE COLOR
Example :this program segment would
display two figures, drawn with doublewide dashed lines.The first is displayed in a
color corresponding to code 5, & second in
color 6.

DTEIT 19/8/

CG-6284

445

LINE COLOR

setLinetype(2);
setLinewidthScaleFactor(2);
setPolylineColorIndex(5);
polyline(n1, wcpoints1);
setPolylineColorIndex(6);
polyline(n2, wcpoints2);

DTEIT 19/8/

CG-6284

446

A PIXEL MASK FOR A RECTANGULAR PEN

DTEIT 19/8/

CG-6284

447

LINE
PATH

THE ASSOCIATED ARRAYOF PIXELS DISPLAYED


BY CENTERING THE MASK OVER A SPECIFIED
PIXEL POSITION.

DTEIT 19/8/

CG-6284

448

GENERATING A LINE WITH THE PEN SHAPE

DTEIT 19/8/

CG-6284

449

CURVE ATTRIBUTES
Parameters for curve attributes are same as
those for line segments.
We can display curves with varying colors,
widths, dot-dash patterns & available pen or
brush options.
DTEIT 19/8/

CG-6284

450

CURVE ATTRIBUTES
Methods for adapting curve-drawing
algorithms to accommodate attribute
selections are similar to those for line
drawing.
The pixel masks are used also uased in raster
curve algorithms to generate dashed or
dotted patterns.

DTEIT 19/8/

CG-6284

451

CURVE ATTRIBUTES
We can generate the dashes in the various
octant using circle symmetry, but we must shift
the pixel positions to maintain the correct
sequence of dashes.
Raster curves of various widths can be
displayed using the method of horizontal or
vertical pixel spans.

DTEIT 19/8/

CG-6284

452

CURVE ATTRIBUTES
Where the magnitude of the curve slope is
less than one, we plot vertical spans; where
the slope magnitude is greater than one, we
plot horizontal span.
Figure demonstrates this method for
displaying a circular arcs of width four in
the first quadrant.

DTEIT 19/8/

CG-6284

453

A DASHED CIRCULAR ARC DISPLAYED WITH A


DASH SPAN OF 3 PIXELS & AN INTERDASH
SPACING OF 2 PIXELS
DTEIT 19/8/

CG-6284

454

CURVE ATTRIBUTES
Using a circle symmetry, we generate the circle path
with vertical spans in the octant from x=0 to x=y &
then reflect pixel positions about the line y=x to
obtain the reminder of the curve shown.
Circle sections in the other quadrants are obtained
by reflecting pixel positions in the first quadrant
about the coordinate axes.

DTEIT 19/8/

CG-6284

455

CURVE ATTRIBUTES

The thickness of curves displayed with this


method is again a function of curve slope.
Circles, ellipses, and other curves will appear
thinnest where the slope has a magnitude of 1.
Another method for displaying thick curves is to
fill in the area between two parallel curve paths,
whose separation distance is equal to the desired
width.

DTEIT 19/8/

CG-6284

456

CURVE ATTRIBUTES
We could do this using the specified curve path as
one boundary & setting up the second boundary
either inside or outside the original curve path.
Disadvantage : this approach , however , shifts
the original curve path either inward or outward,
depending on which direction we choose for the
second boundary.

DTEIT 19/8/

CG-6284

457

CURVE ATTRIBUTES
We can maintain the original curve position by
setting the two boundary curves at a distance of
one half the width on either side of the specified
curve path.
An example of this approach is shown in figure,
for a circle segment with radius 16 & a specified
width of four.

DTEIT 19/8/

CG-6284

458

CIRCULAR ARCS OF WIDTH 4 PLOTTED


WITH PIXEL SPANS

DTEIT 19/8/

CG-6284

459

CURVE ATTRIBUTES
The boundary arcs are then set at a separation
distance of two on either side of the radius of 16.
To maintain the proper dimensions of the circular
arcs, we can set the radii for the concentric boundary
arcs at r=14 & r=17.
The inner & outer boundaries of a fat ellipse
generated with this method do not have the same
foci.

DTEIT 19/8/

CG-6284

460

CURVE ATTRIBUTES
Pen (or brush) displays of curves are
generated using the same techniques.
We replicate a pen shape along the line
path, as illustrated in figure, for circular arc
in the first quadrant.

DTEIT 19/8/

CG-6284

461

A CIRCULAR ARC OF WIDTH 4 & RADIUS 16


DISPLAYED BY FILLING THE REGION BETWEEN
2 CONCENTRIC ARCS.

DTEIT 19/8/

CG-6284

462

CIRCULAR ARC DISPLAYED


WITH A RECTANGULAR PEN

DTEIT 19/8/

CG-6284

463

COLOR & GRAYSCALE LEVELS


Various color & intensity level options can
be made available to a user, depending on
the capabilities & design objectives of a
particular system.
General purpose raster scan system for
example, usually provide a wide range of
colors, while random scan monitors typically
offer only a few color choices, if any.
DTEIT 19/8/

CG-6284

464

COLOR & GRAYSCALE LEVELS


Color options are numerically coded with
values ranging from zero through the
positive integers.
For CRT monitors , these color codes are
then converted to intensity level setting for
the electron beams.

DTEIT 19/8/

CG-6284

465

THE 8 COLOR CODES FOR A THREE BIT PER PIXEL FRAME BUFFER

COLOR STORED COLOR VALUES DISPLAYED


IN FRAME BUFFER
COLOR

Code
0 0
1 0
2 0
3 0
4 1
5 1
6 1
7 1

DTEIT 19/8/

Red
0
0
1
1
0
0
1
1

Green
0
1
0
1
0
1
0
1

Blue
Black
Blue
Green
Cyan
Red
Magenta
Yellow
White

CG-6284

466

COLOR & GRAYSCALE LEVELS


A user can set color table entries in a phigs
applications program with the function :
Setcolourrepresentation(ws, ci, colorptr)
Parameter ws identifies the workstation
output device; parameter ci specifies the color
index, which is the color table position
number(0 to 255)
DTEIT 19/8/

CG-6284

467

COLOR & GRAYSCALE LEVELS


Parameter colorptr points to a trio of RGB
color values (r, g, b) each specified in the
range from 0 to 1.

DTEIT 19/8/

CG-6284

468

COLOR
LOOKUP
TABLE

TO RED GUN
TO GREEN GUN

TO BLUE GUN

Y 196

196

2081

00000000 00001000 00100001

255
X
A COLOR LOOKUP TABLE WITH 24 BITS PER ENTRY
ACCESED FROM A FRAME BUFFERWITH 8 BITS PER PIXEL.
A VALUE OF 196 STORED AT PIXEL POSITION ( X, Y)
REFERENCES THE LOCATION IN THIS TABLE CONTAINING
THEVALUE 2081.
DTEIT 19/8/
CG-6284
469

COLOR & GRAYSCALE LEVELS

There are several advantages in storing color


codes in a lookup table.
Use of a color table can be provide a
reasonable no. of simultaneous colors
without requiring large frame buffers.
For most applications , 256 or 512 different
colors are sufficient for a single picture.

DTEIT 19/8/

CG-6284

470

COLOR & GRAYSCALE LEVELS


Also , table entries can be changed at any
time , allowing a user to be able to
experiment easily with different color
combinations in a design, scene , or graph
without changing attribute setting for the
graphics data structure
.
DTEIT 19/8/

CG-6284

471

COLOR & GRAYSCALE LEVELS


Similarly, visualization applications can
store values for some physical quantity,
such as energy, in the frame buffer & use a
look up table to try out various color in
incodings without changing the pixel
values.
DTEIT 19/8/

CG-6284

472

COLOR & GRAYSCALE LEVELS


And in visualization image processing
applications , color tables are a convenient
means for setting color thresholds so that all
pixel values above or below a specified threshold
can be set to the same color. For these reasons,
some systems provide both capabilities for color
code storage, so that a user can elect either to use
color tables or to store color codes directly in the
frame buffer.
DTEIT 19/8/

CG-6284

473

GRAYSCALE
With monitors that have no color capabilities,
color functions can be used in an application
program to set the shades of gray, or gray
scale, for displayed primitives. Numeric values
over the range 0 to 1 can be used to specify the
gray scale levels, which are then converted to
appropriate binary codes for storage in the
raster.
DTEIT 19/8/

CG-6284

474

GRAYSCALE

This allows the intensity settings to be easily


adapted to systems with differing gray scale
capabilities. In this example, any intensity
+ Input value near 0.33 would be stored as the
binary value 01 in the frame buffer, & pixels with
this value would be displayed as dark gray. When
multiple output devices are available at an
illustration, the same color table interface may be
used for all monitors.

DTEIT 19/8/

CG-6284

475

GRAYSCALE
In this case, a color table for a
monochrome monitor can be setup using a
range of RGB values as in fig, with the
display intensity corresponding to a given
color index ci calculated as:
intensity= 0.5 [ min(r,g,b) + max(r, g, b)]
DTEIT 19/8/

CG-6284

476

Intensity codes for a four level


grayscale system
INTENSITY STORED INTENSITY
CODES
VALUES IN THE

DISPLAYED
GRAYSCALE

FRAME BUFFER (BINARY CODE)

0.0
0.33
0.67
1.0
DTEIT 19/8/

0
1
2
3

(00)
(01)
(10)
(11)
CG-6284

Black
Dark gray
Light gray
White
477

AREA FILL ATTRIBUTES


Options for filling a defined region include
a choice between a solidcolor or a patterned
fill & choices for the particular colors &
patterns.
Area can be painted using various brush
styles , colors, & transparency parameters.
DTEIT 19/8/

CG-6284

478

FILL STYLES
Areas are displayed with three basic fill styles:hollow with a color border, filled with a solid
color or filled with a specified pattern or design.
A basic fill style is selected in a PHIGS
program with the function.
Setinteriorstyle (fs)
Pattern fill
Soft fill

DTEIT 19/8/

CG-6284

479

FILL STYLES
Values for the fill style parameter fs
includes hollow, solid and pattern.
Another values for fill style is hatch, which
is used to fill an area with selected hatching
patterns- parallel lines or crossed lines .

DTEIT 19/8/

CG-6284

480

FILL STYLES
HOLLOW

SOLID

PATTERNED

DTEIT 19/8/

CG-6284

481

PATTERN FILL

AND

OR

PATTERN

BACKGROUND

XOR

COMBINING A FILL PATTERN


REPLACE
WITH
A
BACKGROUND
PATTERN
USING
BOOLEN
OPERATIONS AND, OR, XOR &
PIXEL VALUES
REPLACEMENT.
DTEIT 19/8/
CG-6284
482

CHARACTER ATTRIBUTES
The appearance of displayed is controlled
by attributes such as font size, color, and
orientation.
Attributes can be set both for entire
character strings (text) and for individual
characters defined as marker symbols.

DTEIT 19/8/

CG-6284

483

TEXT ATTRIBUTES
There are a great many text options that
can be made available to graphics
programmer's.
First of all, there is the choice of font
which is a set of characters with a particular
design style such as arial, times new roman.

DTEIT 19/8/

CG-6284

484

TEXT ATTRIBUTES
The character in a selected can also be
displayed with assorted underlying styles
(solid dotted , double ), in bold face, in italics,
and in out line or shadow styles.
A particular font & associated style is selected
in a PHIGS program by setting an integer code
for the text font parameter tf in the function :
settextfont (tf)

DTEIT 19/8/

CG-6284

485

Character body

kern

top
cap

H f j
Character
height
base
bottom

kern

These characteristics of character body can be


changed with different functions in graphics package.
DTEIT 19/8/

CG-6284

486

Height 1

Height 1

Height 3

THE
EFFECT
OF
DIFFERENT CHARACTER
HEIGHT SETTINGS ON
DISPLAYED TEXT.

Text size can be adjusted without changing


the width-to-height ratio of character with :
setCharacterheight(ch)
parameter ch is assigned a real value
greater than 0 to set the coordinate height of
capital letters.
DTEIT 19/8/

CG-6284

487

Width 0.5
Width 1.0
Width 2.0

The Effect of different character


width settings displayed text.

The width only of text can be set with the


function :
setCharacterExpansionFactor (cw)
where the character width parameter cw is
set to a positive real value that scales the
body width of characters.
DTEIT 19/8/

CG-6284

488

Spacing 1.0

Spacing 0.0

Spacing 0.5

Spacing between character is controlled


separately with :
Setcharacterspacing(cs)
Where the character spacing parameter cs
can be assigned any real value.

DTEIT 19/8/

CG-6284

489

SL
A

UP VECTOR

NT

ED

TE
X

DIRECTION
OF
UP
VECTOR & CONTROLS
THE ORIENTATION OF
DISPLAYED TEXT.

The orientation for a displayed character


string is set according to the direction of the
character up vector :
setcharacterupvector(upvect)
Parameter upvect in this function is
assigned two values that specify the x & y
vector components.
DTEIT 19/8/

CG-6284

490

V
E
R
T

HORIZONTAL TEXT

I
C
A
L

TEXT PATH ATTRIBUTES


CAN BE SET TO PRODUCE
HORIZONTAL & VERTICAL
ARRANGEMENTS
OF
CHARACTER STRINGS.

It is useful in many applications to be able


to arrange character strings vertically or
horizontally.
setTextPath (tp)
where the text path parameter tp can be
assigned the value : right, left, up, or down.
DTEIT 19/8/

CG-6284

491

S
T
R
I
N
G

top
cap

top

STRING

cap
half
base
bottom

half

base
bottom

DTEIT 19/8/

ALIGNMENT
ATTRIBUTE
VALUES FOR HORIZONTAL
& VERTICAL STRINGS
CG-6284

492

P
U

FT
LE

UP VECTORS TO CONTROL
THE DIRECTION OF THE
TEXT PATH

D
N

H
IG
R

W
O

Another handy attribute for character strings


is alignment.
setTextAlignment(h,v)
where parameters h & v control
horizontal & vertical allignment, respectively
assigning h a value of left, centre, or right,
asiigning v a value of top, cap, half, base, or
bottom.

DTEIT 19/8/

CG-6284

493

A precision specification for text display is


given with :
setTextPrecision(tpr)
where the text precision parameter tpr is
assigned one of the values strings,
characters or stroke.

DTEIT 19/8/

CG-6284

494

MARKER ATTRIBUTES
A marker symbol is a single character that can be
displayed in different colors & in different sizes.
Marker attributes are implemented by procedures
that load the chosen character into the raster at the
defined positions with the specified color & size.
We select a particular character to be the marker
symbol with :

DTEIT 19/8/

CG-6284

495

MARKER ATTRIBUTES
setMarkerType(mt)
where the marker type parameter mt is set to an
integer code. Typical codes for marker type are the
integers 1 through 5.
We set the marker size with :
setMarkerSizeScaleFactor(ms)
with parameter marker size ms assigned a positive
no.
DTEIT 19/8/

CG-6284

496

MARKER ATTRIBUTES
Marker color is specified with :
setpolymarkercolorindex(mc)
A selected color code for parameter mc is
stored in the current attribute list & used to
display subsequently specified marker
primitives.
DTEIT 19/8/

CG-6284

497

OUTPUT
PRIMITIVE
TYPE

ASSOCIATED
ATTRIBUTES

ATTRIBUTE SETTING
FUNCTIONS

Line
Type setLinetype
Width
setLineWidthScaleFactor
Color
setPolylineColorIndex
Text
Font setTextFont
Color
setTextColorIndex
Size
setCharcterHeight
setCharcterExpansionFactor
Orientation
setCharcterUpVector
setTextPath
setTextAlignment
DTEIT 19/8/

CG-6284

498

OUTPUT
PRIMITIVE
TYPE

ASSOCIATED
ATTRIBUTES

Fill Area

Fill Style
Fill Color
Pattern

Marker

Type
Size
Color

DTEIT 19/8/

ATTRIBUTE SETTING
FUNCTIONS

setInteriorStyle
setInteriorColorIndex
setInteriorStyleIndex
setPatternRepresentation
setPatternsize
setPatternReferencePoint
setMarkerType
setMarkersizeScaleFactor
setPolyMarkerColourIndex
CG-6284

499

EXERCISE 2
Write a program to draw a line using
DDA algorithm in C language.
Write a program to draw a line using
Bresenhams algorithm using C
language.
Write a program to draw a circle using
mid-point algorithm using C language.
DTEIT 19/8/

CG-6284

500

EXERCISE 2
Modify mid-point circle algorithm to display
ellipse, as specified by input values for the
ellipse center and the major and minor
axis.Write a program to implement this
algorithm on your system.
Using DDA algorithm draw a triangle,
rectangle etc.
DTEIT 19/8/

CG-6284

501

EXERCISE 2
Modify a line-drawing algorithm so that
the intensity of the output is set
according to its slope.That is by
adjusting pixel intensity according to the
value of the slope, all lines are displayed
with the same intensity per unit length.

DTEIT 19/8/

CG-6284

502

DTEIT 19/8/

CG-6284

503

Potrebbero piacerti anche