0% found this document useful (0 votes)
29 views62 pages

CG CST304

The document provides an overview of computer graphics, detailing its definition, applications, and types, including interactive and passive graphics. It explains the functioning of video display devices, particularly CRTs, and discusses raster-scan and random-scan systems, along with color CRT techniques. Additionally, it covers line drawing algorithms used in graphics rendering, specifically the DDA and Bresenham’s algorithms.

Uploaded by

Cinu Joseph
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views62 pages

CG CST304

The document provides an overview of computer graphics, detailing its definition, applications, and types, including interactive and passive graphics. It explains the functioning of video display devices, particularly CRTs, and discusses raster-scan and random-scan systems, along with color CRT techniques. Additionally, it covers line drawing algorithms used in graphics rendering, specifically the DDA and Bresenham’s algorithms.

Uploaded by

Cinu Joseph
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 62

CG- MODULE 1

CST 304
Prepared By
Liya Prakash
“ A picture is worth a thousand words”
• The term computer graphics is an art of drawing
pictures, lines, charts, etc using computers with the help
of programming.
• It involves creation , storage and manipulation.
• Computer Graphics express data in pictorial form.
• It displays information in the form of graphics objects such
as pictures, charts ,graphs etc instead of simply text.
Applications of computer graphics

• Entertainment
• Medical Imaging and Scientific Visualization
• Computer Aided Design
• Education & training
• Computer Art
• Presentation graphics
• Image processing
• GUI
• A display area is represented as a collection of discrete
picture elements called pixels.
• Pixel is the smallest addressable unit on the screen.
Each pixel has got some information like its intensity and
color.
• Basically there are two types of computer graphics
namely Interactive Computer Graphics and Passive
Computer Graphics.
Interactive Computer Graphics
• It involves a two way communication between computer and
user.
• The observer is given some control over the image by providing
him with an input device .
• For example: Observer send his request to the computer
through video game controller. Computer on receiving signals
can modify the displayed picture appropriately.
Non Interactive Computer Graphics
• It is also known as passive computer graphics.
• The user does not have any kind of control over the image.
• It involves only a one way communication.
• The image is merely the product of static stored program and
will work according to the instructions given in the program
linearly.
• The image is totally under the control of program instructions,
not under the user. Example: images shown on television.
Video Display Devices: CRT

• 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).
• The beam of electrons are emitted by an electron gun. It
passes through focusing and deflection systems that
direct the beam toward specified positions on the
phosphor coated screen.
• Thus phosphor emits a small spot of light at each position
contacted by the electron beam.
• Because the light emitted by the phosphor fades very
rapidly, some method is needed for maintaining the
screen picture.
• One way 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
• The primary components of an electron gun in a CRT are
the heated metal, cathode and a control grid.
• A smaller negative voltage on the control grid simply
decreases the number of electrons passing through the
small hole at the end of the control grid structure.
• A high negative voltage applied will stop electrons from
passing through it.
• The focusing system force the electron beam to converge
into a small spot as it strikes the phosphor. Otherwise, the
electrons would repel each other, and the beam would
spread out as it approaches the screen.
• Focusing is accomplished with the help of either electric
or magnetic fields.
• It is commonly constructed with a pair of magnetic
deflection coils mounted on CRT envelope. The magnetic
field produced by each pair of coils directs the electron
beam properly. Horizontal deflection is accomplished with
one pair of coils, and vertical deflection by the other pair.
• When electrostatic deflection is used, two pairs of parallel
plates are mounted inside the CRT envelope. One pair of
plates is mounted horizontally to control the vertical
deflection, and the other pair is mounted vertically to
control horizontal deflection.
Basic Terms

• Picture element
• Intensity value
• Resolution
• Aspect Ratio
Raster scan display
• It is the most common type of CRT monitor.
• In this system, the electron beam is swept across the screen
one row at a time from top to bottom.
• Beam intensity is turned on and off to create a pattern of
illuminated spots as the electron moves across each row.
• In a raster scan system entire screen is considered as a
matrix of pixels.
• Each screen point is referred to as a pixel or pel (shortened
form of picture element).
• Frame buffer or refresh buffer is a memory where picture
definition is stored .i.e. set of all intensity values for all pixels
is stored in refresh buffer.
• Horizontal Retrace: 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.
• Vertical retrace: At the end of each frame the
electron beam returns to the top left corner of the
screen to begin the next frame.
• Interlacing: In this method, each frame is
displayed in two passes using an interlaced
refresh procedure. First all the points on the
even numbered scanlines are displayed ,and
then all the odd numbered lines are displayed.
Entire screen is displayed in half time , providing
that adjacent scanlines contain similar
information.
• 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.
• Bit value of 1 indicates that the electron beam is to be
turned on that position, and a value of 0 indicates that the
beam intensity is to be turned off.
• Additional bits are needed when color and intensity
variations are to be displayed.
• On a black-and-white system with one bit per pixeI, the
frame buffer is commonly called a bitmap.
• For systems with multiple bits per pixel, the frame buffer is
referred to as a pixmap.
• Refreshing on raster scan displays is carried out at the rate
of 60 to 80 frames per second.
• Home television sets and printers are examples of other
systems using raster-scan methods.
RASTER-SCAN SYSTEMS
• In Interactive raster graphics systems, in addition
to the CPU ,a special-purpose processor, called
the video controller or display controller, is used
to control the operation of the display device.
• A fixed area of the system memory is reserved for the frame
buffer, and the video controller is given direct access to the
frame-buffer memory.
• Frame-buffer locations, and the corresponding screen
positions, are referenced in Cartesian coordinates.
• For many graphics monitors, the coordinate origin is defined at
the lower left screen corner.
• The screen surface is represented as the first quadrant of a
two-dimensional system, with positive x values increasing to
the right and positive y values increasing from bottom to top.
• Scan lines are then labeled from ymax at the top of the screen
to 0 at the bottom.
• Along each scan line, screen pixel positions are labeled from 0
to xmax.
• On some personal computers, the coordinate origin is
referenced at the upper left comer of the screen, so the y
values are inverted.
• Two registers are used to store the coordinates of the screen
pixels: x register and y register.
• Initially, x register is set to 0 and the y register is set to y max.
• The value stored in the frame buffer for this pixel position is
then retrieved and used to set the intensity of the CRT beam.
• Then the x register is incremented by 1, and the process
repeated for the next pixel on the top scan line.
• This procedure is repeated for each pixel along the scan line.
• After the last pixel on the top scan line has been processed, the
x register is reset to 0 and the y register is decremented by 1.
• Pixels along this scan line are then processed in turn, and the
procedure is repeated for each successive scan line.
• After cycling through all pixels along the bottom scan line (y =
0), the video controller resets the registers to the first pixel
position on the top scan line and the refresh process starts over.
• To speed up pixel processing, video controllers can
retrieve multiple pixel values from the refresh buffer on
each pass.
• The multiple pixel intensities are then stored in a separate
register called pixel register and used to control the CRT
beam intensity for a group of adjacent pixels.
• In addition to the system memory, a separate display
processor memory area can also be provided. Main
purpose is digitizing a picture definition given in an
application program into a set of pixel-intensity values for
storage in the frame buffer. This digitization process is
caIled scan conversion.
Random scan display
• It is also called as calligraphic displays, vector displays, stroke
displays.
• The electron beam is 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.
• A pen plotter operates in a similar way and is an example of a
random-scan, hard-copy device.
• Picture definition is stored as a set of line drawing commands in an
area of memory referred to as refresh display file/refresh buffer.
• To display a specified picture ,the system cycles through a set of
commands in the display file , drawing each component line.
• After all line drawing commands have been processed, the system
cycles back to the first line command in the list.
• Random-scan displays are scan displays are designed to draw all the
component lines of a picture 30 to 60 times
RANDOM-SCAN SYSTEMS
• An application program is input and stored in the system memory
along with a graphics package.
• Graphics commands in the application program are translated by
the graphics package into a display file stored in the system
memory.
• 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.
• Sometimes the display processor in a random-scan system is
referred to as a display processing unit or a graphics controller.
• Graphics patterns are drawn on a random-scan system by directing
the electron beam along the component lines of the picture.
• Lines are defined by the values for their coordinate endpoints, and
these input coordinate values are converted to x and y deflection
voltages.
• A scene is then drawn one line at a time by positioning the beam
Color CRT

• A CRT monitor displays color pictures by using a


combination of phosphors that emit different colored light.
• By combining the emitted light from the different
phosphors, a range of colors can be generated.
• The two basic techniques are beam-penetration method
and Shadow mask method.
Beam-penetration Method
• In this method, two layers of phosphor, usually red and green,
are coated onto the inside of the CRT screen.
• The displayed color depends on how far the electron beam
penetrates into the phosphor layers.
• A beam of slow electrons excites only the outer red layer.
• A beam of very fast electrons penetrates through the red
layer and excites the inner green layer.
• At intermediate beam speeds, combinations of red and green
light are emitted to show two additional colors, orange and
yellow.
• The speed of the electrons, and hence the screen color at
any point, is controlled by the beam-acceleration voltage.
Advantage:
• An inexpensive way to produce color in random-scan
monitors
Disadvantage:
•Only four colors are possible
•quality of pictures is not as good as with other
methods.
Shadow-mask Method
• This method is commonly used in color TV because they produce a
much wider range of colors than the beam penetration method.
• A shadow-mask CRT has three phosphor color dots at each pixel
position.
• One phosphor dot emits a red light, another emits a green light,
and the third emits a blue light.
• This type of CRT has three electron guns, one for each color dot,
and a shadow-mask grid just behind the phosphor-coated screen.
• The three electron beams are deflected and focused as a group
onto the shadow mask, which contains a series of holes aligned
with the phosphor-dot patterns.
• When the three beams pass through a hole in the shadow mask,
they activate a dot triangle, which appears as a small color spot on
the screen.
• The phosphor dots in the triangles are arranged so that each
electron beam can activate only its corresponding color dot when it
passes through the shadow mask.
• Color variations are obtained by varying the intensity
levels of the three electron beams.
• By turning off red and green guns, we get only blue
phosphor.
• The color we see depends on the amount of excitation of
the red, green, and blue phosphors.
• A white area is the result of activating all three dots with
equal intensity.
Yellow -> green and red dots
Magenta -> blue and red dots
Cyan ->blue and green
Direct-View Storage Tubes

• An alternative method for maintaining a screen image is to store


the picture information inside the CRT instead of refreshing the
screen.
• A direct-view storage tube (DVST) stores the picture information
as a charge distribution just behind the phosphor-coated screen.
• Two electron guns are used in a DVST- Primary gun & Flood gun.
• The Primary gun used to store the picture as pattern of positive
charges on storage grid.
• The Flood gun used to maintains the picture display.
• Picture pattern is transferred to phosphor by continuous flood of
electron generated from flood gun.
• Electrons are attracted by positively charged picture pattern on
storage grid and are repelled by rest.
• The attracted electrons strike on phosphor making it visible on
screen.
Advantages
Because no refreshing is needed, very complex pictures can be
displayed at very high resolutions without flicker.
Disadvantages
∙ they ordinarily do not display color
∙ selected parts of a picture cannot be erased. To eliminate a
picture section, the entire screen must be erased and the
modified picture redrawn.
LINE DRAWING ALGORITHMS
•There are two algorithms for drawing a line

 DDA line drawing algorithm

 Bresenham’s line drawing algorithm


Principle used for line drawing
algorithms
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 positions
(x 1,y1) and (x2, y2), as shown in
Figure.

• We can determine the slope m and y


intercept b

Algorithms for displaying straight lines


are based on the line equation (1) and
ca9l/c21u/l2a0t2i0ons given in
the
9
Eqs. (2)
• k takes integer values starting from 1 and
increases by 1 until the final point is reached.
• m can be any number between 0 and 1.
• Calculated y values must be rounded off to
the nearest integer.
• For lines with positive slope greater than 1,
sample at unit y intervals (~y
calculate each successive
1) =
=
Xk+1 xk + 11m and
x value as
The above eqns are based on the assumption
that lines are processed from left to right. If
the processing is reversed then

~x = -1 & Yk+1 = Yk - m -_ Slope >1


~Y = -1 & Xk+1 = xk-1/m Slope <1
MAHAGURU INSTITUTE OF TECHNOLOGY
ALGORITHM
Step1: Input two end point pixel positions (x1, y1) and (x2, y2)
Step2: Find horizontal and vertical difference between the end points
dx = x2-x1
dy = y2-y1
Step3: The difference with the greater magnitude determines the value of
parameter steps
If abs (dx)>abs (dy) then steps = abs
(dx)
else
steps = abs (dy)
Step4: Starting with pixel position (x1, y1) be determined offset needed at each
step to generate next pixel along the line path.
xincrment = dx/steps yincrement
=dy/steps
step5: Loop through this process steps times.
x = x + xincrement
y = y + yincrement
Step6:Plot the pixel at (x, y) position, set pixel (round(x), round(y).
Advantages
• It is the simplest algorithm and it does not require special skills for
implementation.
It is a faster method for calculating pixel positions than the direct
• use of equation y=mx + b.

Disadvantages:
(1)• The rounding operation & floating point arithmetic are time
consuming procedures.
Perform integer arithmetic by storing float as integers in numerator and
denominator and performing integer arithmetic

(2) Round-off error can cause the calculated pixel position to drift away
from the true line path for long line segment. Hence end point
accuracy is poor.

20
Bresenham’s line drawing algorithm
ADVANTAGE
S
• Bresenham’s algorithm generally faster than DDA

• Bresenham’s algorithm uses integer arithmetic

• Constants need to be computed only once

• Reduces complexity
• More accurate than DDA
CIRCLE DRAWING ALGORITHMS

There are two algorithms for generating a


circle
• Midpoint circle drawing algorithm
• Bresenham’s circle drawing algorithm
MID POINT CIRCLE DRAWING
ALGORITHM
40
• The radius of a circle is 8, and center point coordinates are (0,
0). Apply bresenham’s circle drawing algorithm to all
plot points of the circle.
(xo ,yo) =(0,r) =(0,8)
Now, we will the initial decision parameter (P0)
calculate
P0 = 3 – 2 x r
P0 = 3 – 2 x 8
P0 = -13
The value of initial parameter P0 < 0. So, case 1 is satisfied.
Thus,
xk+1 =xk + 1 = 0 + 1 = 1
yk+1 =yk = 8
Pk+1 = Pk + 4xk+1 + 6 = –13 + (4 x 1) + 6 = –3
• Follow step 3 until we get x >= y.
k pk pk+1 (xk+1,yk+1)

0 (0, 8)
1 -13 -3 (1, 8)
2 -3 11 (2, 8)
3 11 5 (3, 7)
4 5 7 (4, 6)
5 7 (5, 5)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy