Computer graphics is the field of study and application of computer technology to create,
manipulate, and display visual information. Computer graphics has its roots in the 1950s and 1960s,
when computers were first used to create simple graphics. The field has since evolved rapidly, with
significant advances in hardware, software, and algorithms.
It is difficult to display an image of any size on the computer screen. This method is simplified by
using Computer graphics. Graphics on the computer are produced by using various algorithms and
techniques. he role of computer graphics insensible. In today life, computer graphics has now
become a common element in user interfaces, T.V. commercial motion pictures. Computer Graphics
is the creation of pictures with the help of a computer. The end product of the computer graphics is a
picture it may be a business graph, drawing, and engineering. In computer graphics, two or three-
dimensional pictures can be created that are used for research. Today computer graphics is entirely
different from the earlier one. It is not possible. It is an interactive user can control the structure of
an object of various input devices. Computer Graphics: It is the use of computers to create and
manipulate pictures on a display device.
Why computer graphics used? Suppose a shoe manufacturing company want to show the
sale of shoes for five years. For this vast amount of information is to store. So a lot of time
and memory will be needed. This method will be tough to understand by a common man. In
this situation graphics is a better alternative. Graphics tools are charts and graphs. Using
graphs, data can be represented in pictorial form. A picture can be understood easily just
with a single look.
Display Processor: It is interpreter or piece of hardware that converts display processor code
into pictures. It is one of the four main parts of the display processor
Parts of Display Processor
Display File Memory, Display Processor, Display Generator, Display Console
Display File Memory: It is used for generation of the picture. It is used for identification of graphic
entities.
1. Display Controller: It handles interrupt
2. It maintains timings
3. It is used for interpretation of instruction.
Display Generator: It is used for the generation of character.
2. It is used for the generation of curves.
Display Console: It contains CRT, Light Pen, and Keyboard and deflection system. The raster scan
system is a combination of some processing units. It consists of the control processing unit (CPU) and
a particular processor called a display controller. Display Controller controls the operation of the
display device. It is also called a video controller.
Working: The video controller in the output circuitry generates the horizontal and vertical drive
signals so that the monitor can sweep. Its beam across the screen during raster scans.
Display Devices: The most commonly used display device is a video monitor. The operation of
most video monitors based on CRT (Cathode Ray Tube). The following display devices are used:
1. Refresh Cathode Ray Tube
2. Random Scan and Raster Scan
3. Color CRT Monitors
4. Direct View Storage Tubes
5. Flat Panel Display
6. Lookup Table
Cathode Ray Tube (CRT): CRT stands for Cathode Ray
Tube. CRT is a technology used in traditional computer monitors and
televisions. The image on CRT display is created by firing electrons from the
back of the tube of phosphorus located towards the front of the screen. Once
the electron heats the phosphorus, they light up, and they are projected on a
screen. The color you view on the screen is produced by a blend of red, blue
and green light.
Components of CRT:
1. Electron Gun: Electron gun consisting of a series of elements, primarily a
heating filament (heater) and a cathode. The electron gun creates a source of
electrons which are focused into a narrow beam directed at the face of the
CRT.
2. Control Electrode: It is used to turn the electron beam on and off.
3. Focusing system: It is used to create a clear picture by focusing the
electrons into a narrow beam.
4. Deflection Yoke: It is used to control the direction of the electron beam.
5. Phosphorus-coated screen: The inside front surface of every CRT is
coated with phosphors. Phosphors glow when a high-energy electron beam
hits them. Phosphorescence is the term used to characterize the light given
off by a phosphor after it has been exposed to an electron beam.
Random Scan and Raster Scan Display:
Random Scan Display: Random Scan System uses an electron beam which
operates like a pencil to create a line image on the CRT screen. The picture is
constructed out of a sequence of straight-line segments. Each line segment is
drawn on the screen by directing the beam to move from one point on the
screen to the next, where its x & y coordinates define each point. After
drawing the picture. The system cycles back to the first line and design all the
lines of the image 30 to 60 time each second.
Advantages:
1. A CRT has the electron beam directed only to the parts of the screen
where an image is to be drawn.
2. Produce smooth line drawings.
3. High Resolution
Disadvantages:Random-Scan monitors cannot display realistic shades scenes.
Raster Scan Display:A Raster Scan Display is based on intensity control of
pixels in the form of a rectangular box called Raster on the screen.
Information of on and off pixels is stored in refresh buffer or Frame buffer.
Televisions in our house are based on Raster Scan Method. The raster scan
system can store information of each pixel position, so it is suitable for
realistic display of objects. Raster Scan provides a refresh rate of 60 to 80
frames per second.
Frame Buffer is also known as Raster or bit map. In Frame Buffer the positions
are called picture elements or pixels. Beam refreshing is of two types. First is
horizontal retracing and second is vertical retracing. When the beam starts
from the top left corner and reaches the bottom right scale, it will again return
to the top left side called at vertical retrace.
Types of Scanning or travelling of beam in Raster Scan 1.
Interlaced Scanning
1. Non-Interlaced Scanning
In Interlaced scanning, each horizontal line of the screen is traced from top to
bottom.
For non-interlaced display refresh rate of 30 frames per second used. But it
gives flickers. For interlaced display refresh rate of 60 frames per second is
used.
Advantages:
1. Realistic image
2. Million Different colors to be generated
3. Shadow Scenes are possible.
Disadvantages:
1. Low Resolution
2. Expensive
Random Scan Raster Scan
1. It has high Resolution 1. Its resolution is low.
2. It is more expensive 2. It is less expensive
3. Any modification if needed is easy 3.Modification is tough
4. Solid pattern is tough to fill 4.Solid pattern is easy to fill
5. Refresh rate does not depend on the
5. Refresh rate depends or resolution
picture.
6. Only screen with view on an area is
6. Whole screen is scanned.
displayed.
7. Beam Penetration technology come 7. Shadow mark technology came under
under it. this.
8. It does not use interlacing method. 8. It uses interlacing
9. It is restricted to line drawing
9. It is suitable for realistic display.
applications
Color CRT Monitors: The CRT Monitor display by using a combination of
phosphors. The phosphors are different colors. There are two popular
approaches for producing color displays with a CRT are:
1. Beam Penetration Method
2. Shadow-Mask Method
1. Beam Penetration Method: The Beam-Penetration
method has been used with random-scan monitors. In this method, the
CRT screen is coated with two layers of phosphor, red and green and
the displayed color depends on how far the electron beam penetrates
the phosphor layers. This method produces four colors only, red, green,
orange and yellow. A beam of slow electrons excites the outer red layer
only; hence screen shows red color only. A beam of high-speed
electrons excites the inner green layer. Thus screen shows a green
color.
Advantages: Inexpensive
Disadvantages:
1. Only four colors are possible
2. Quality of pictures is not as good as with another method.
2. Shadow-Mask Method: Shadow Mask Method is commonly used in Raster-
Scan System because they produce a much wider range of colors than the
beam-penetration method.
o It is used in the majority of color TV sets and monitors.
Advantage:
1. Realistic image
2. Million different colors to be generated
3. Shadow scenes are possible
Disadvantage:
1. Relatively expensive compared with the monochrome CRT.
2. Relatively poor resolution
3. Convergence Problem
Direct View Storage Tubes: DVST terminals also use the
random scan approach to generate the image on the CRT screen. The term "storage
tube" refers to the ability of the screen to retain the image which has been projected
against it,
Function of guns: Two guns are used in DVST
1. Primary guns: It is used to store the picture pattern.
2. Flood gun or Secondary gun: It is used to maintain picture display.
Advantage:
1. No refreshing is needed.
2. High Resolution
3. Cost is very less
Disadvantage:
1. It is not possible to erase the selected part of a picture.
2. It is not suitable for dynamic graphics applications.
3. If a part of picture is to modify, then time is consumed.
Flat Panel Display:The Flat-Panel display refers to a class
of video devices that have reduced volume, weight and power
requirement compare to CRT. Example: Small T.V. monitor, calculator,
pocket video games, laptop computers, an advertisement board in
elevator
1. Emissive Display: The emissive displays are devices that convert electrical
energy into light. Examples are Plasma Panel, thin film electroluminescent
display and LED (Light Emitting Diodes).
2. Non-Emissive Display: The Non-Emissive displays use optical effects to
convert sunlight or light from some other source into graphics patterns.
Examples are LCD (Liquid Crystal Device).
Plasma Panel Display: Plasma-Panels are also called as Gas-Discharge Display.
It consists of an array of small lights. Lights are fluorescent in nature. The
essential components of the plasma-panel display are:
1. Cathode: It consists of fine wires. It delivers negative voltage to gas
cells. The voltage is released along with the negative axis.
2. Anode: It also consists of line wires. It delivers positive voltage. The
voltage is supplied along positive axis.
3. Fluorescent cells: It consists of small pockets of gas liquids when the
voltage is applied to this liquid (neon gas) it emits light.
4. Glass Plates: These plates act as capacitors. The voltage will be applied,
the cell will glow continuously.
LCD (Liquid Crystal Display): Liquid Crystal Displays are the
devices that produce a picture by passing polarized light from the surroundings.
LCD uses the liquid-crystal material between two glass plates; each plate is the
right angle to each other between plates liquid is filled. Liquid crystal display is
temperature dependent. It is between zero to seventy degree Celsius. It is flat
and requires very little power to operate. Advantage:
1. Low power consumption.
2. Small Size
3. Low Cost
Disadvantage:
1. LCDs are temperature-dependent (0-70°C)
2. LCDs do not emit light; as a result, the image has very little contrast.
3. LCDs have no color capability.
4. The resolution is not as good as that of a CRT.
Look-Up Table: Image representation is essentially the description of pixel
colors. There are three primary colors: R (red), G (green) and B (blue). Each
primary color can take on intensity levels produces a variety of colors. Using
direct coding, we may allocate 3 bits for each pixel, with one bit for each
primary color. The 3-bit representation allows each primary to vary
independently between two intensity levels: 0 (off) or 1 (on). Hence each
pixel can take on one of the eight colors.
Bit 1:r Bit 2:g Bit 3:b Color
name
0 0 0 Black
0 0 1 Blue
0 1 0 Green
0 1 1 Cyan
1 0 0 Red
1 0 1 Magenta
1 1 0 Yellow
1 1 1 White
A widely accepted industry standard uses 3 bytes, or 24 bytes, per pixel, with
one byte for each primary color. The way, we allow each primary color to
have 256 different intensity levels. Thus a pixel can take on a color from 256
x 256 x 256 or 16.7 million possible choices. The 24-bit format is commonly
referred to as the actual color representation.
Character Generator (CG) In the world of video production, a character
generator (CG) is a software application that produces static or animated text
for use in 2D and 3D videos. A CG can be used to create anything from simple
Lower Thirds text to full-blown 3D animations. A character generator, or CG, is
a tool used to create digital characters. These characters can be used in video
games, movies, and other digital media. CGs are created by artists who
design the characters and then use software to bring them to life. There are
many different types of character generators, but the most common one is
the 3D character generator. This type of CG allows artists to create realistic-
looking characters that can be used in movies and video games. 3D character
generators are usually very expensive and require a lot of experience to use.
2D character generators are also common, but they are not as realistic as 3D
CGs. 2D CGs are often used for cartoons and other types of artwork. They are
usually less expensive than 3D character generators and easier to use. No
matter what type of character generator you use, the process of creating a
digital character generally follows the same steps: first, the artist designs the
character; then, they build the model using software; finally, they animate the
character using motion capture or keyframing techniques.
Advantages of Character Generator: There are many benefits to using a
character generator when creating characters for your stories. Perhaps the
most obvious benefit is that it can save you a lot of time. If you’re not
experienced in drawing or creating digital art, it can be very time-consuming
to create believable and detailed characters. With a character generator, you
can simply input your desired characteristics and have a professional-looking
character in minutes.
Another great benefit of using a character generator is that you can try out
different looks for your characters without having to commit to one right
away. This can be helpful if you’re unsure of what kind of look you want for
your story, or if you want to experiment with different designs before
finalizing anything. You can also easily change up a character’s appearance if
you decide you want to go in a different direction later on.
Overall, using a character generator can be a huge time-saver and allow you
to create more polished and professional-looking characters than if you were
to attempt to create them yourself from scratch. If you’re looking to save time
and create high-quality characters for your stories, then using a character
generator is definitely something worth considering.
Types of Character Generators: There are several different types of
character generators, each with its own unique capabilities. Here are a few of
the most common:
1. 2D character generators create two-dimensional characters that can be
used in a variety of applications, such as video games or animated films.
2. 3D character generators create three-dimensional characters that can be
used in a variety of applications, such as video games or animated films.
3. Motion capture character generators use motion capture technology to
record the movement of real people and then generate realistic character
animations from that data.
4. Facial recognition character generators use facial recognition algorithms to
generate characters that look like specific people or celebrities.
Interactive Graphical Techniques
To construct various images and graphics in interactive manner, there are
different methods which are built into various graphics packages. These
packages contains various options which help user to enter information of
coordinate by using stroke devices or various locators.
Positioning Techniques :
It very basic technique of graphical input. It is also known as locating.
With the help of input device, user indicates position on the screen. To
display object this position marks location. Example: input position can be
used to insert symbol to specify endpoint of line.
The process of positioning involves two steps, in first step user have to
move cursor to desired spot on screen and in second step user inform
computer by pressing key or button.
The positioning is very often used in geometric modeling applications,
where if user wants to define new element of model or to change position
of already existing model.
Positioning Constraints : Constraint is rule which is used by user to
change value of coordinates to produce required alignment of displayed
coordinates. There are 3 types of positioning constraints which are as
follows
Figure – Types of Constraints
Directional constraint – Directional constraint is used to straight line
segment. It is basically used to create horizontal and vertical lines; without
thinking about endpoint coordinates. The user specifies two endpoints. The
distance between two input points is length of line.
Figure – Directional Constraint
Modular constraint – This constraint uses grid of rectangular areas which is displayed o screen. Any
input coordinate position is to be present on nearest intersection of two grid lines. This constraint is
applicable to symbols as well as line endpointsFigure – Modular Constraint
Figure – Modular Constraint
Gravity Field – This constraint is useful where there is need to attach line or line in already existing
picture. In this, picture does not lie on grid system. The name of this constraint is so because there is
gravitational pull in between lines on screen. Gravity fields size is chosen not very large enough to aid
positioning but small to reduce chances of overlapping with other lines.
Rubber Band Method : This method is used to construct and position straight line segments. This
method stretch line from starting position as movement of screen cursor. The user first selects
position from one endpoint of line and then it moves cursor around, hen line is displayed from where
user start cursor and position where cursor is placed now. Finally when user selects second endpoint
on screen, then final line is displayed from starting endpoint to second endpoint on screen.
The name is Elastic or Rubber Band Technique because of effect of elastic line which is stretched
between first endpoint and cursor.
In this method user will get idea about line which user is drawing before actually fixing that line.
Figure – Rubber band line
This method is also used to draw other geometric entities like arc and rectangles. The rectangle using
this method is shown in the following figure:
Figure – Rectangle using rubber band technique
Inking : It is other technique used to create geometric patterns.
In this method locator itself leaves trail of line segment as way pen leaves trail of ink.
There is no need of pushing button for every line segment in required picture. In this method
automatically new line is drawn when locator move towards sufficient distance which is as shown in
the following figure:
Zooming ->Zooming is a transformation often provided with an imaginary software. The
transformation effectively scales down or blows up a pixel map or a portion of it with the instructions
from the user. Such scaling is commonly implemented at the pixel level rather than at the
coordinates level. A video display or an image is necessarily a pixel map, i.e., a collection of pixels
which are the smallest addressable elements of a picture. The process of zooming replicates pixels
along successive scan lines. Example: for a zoom factor of two
Each pixel value is used four times twice on each of the two successive scan lines.
Figure shows the effect of zooming by a factor of 2.
There are widely used, especially when the grey levels (share of brightness) are synthetically
generated.
Panning ->The process of panning acts as a qualifier to the zooming transformation. This step moves
the scaled up portion of the image to the center of the screen and depending on the scale factor, fill
up the entire screen. Advantage:
Effective increase in zoom area in all four direction even if the selected image portion (for zooming) is
close to the screen boundary.
Inking: If we sample the position of a graphical input device at regular intervals and display a dot at
each sampled position, a trial will be displayed of the movement of the device.This technique which
closely simulates the effect of drawing on paper is called Inking.
For many years the primary use of inking has been in conjunction with online character-recognition
programs.
Scissoring: In computer graphics, the deleting of any parts of an image which falls outside of a
window that has been sized and laid the original vision ever. It is also called the clipping.
Clipping: when we have to display a large portion of the picture, then not only scaling & translation is
necessary, the visible part of picture is also identified. This process is not easy. Certain parts of the
image are inside, while others are partially inside. The lines or elements which are partially visible
will be omitted.
Types of Lines: Lines are of three types:
1. Visible: A line or lines entirely inside the window is considered visible
2. Invisible: A line entirely outside the window is considered invisible
3. Clipped: A line partially inside the window and partially outside is clipped. For clipping point
of intersection of a line with the window is determined.
Line drawing algorithms are essential in computer graphics for rendering lines on a screen.
One of the most widely used algorithms is Bresenham's line algorithm. Here's how it works:
1. Basic Concept: The algorithm determines which points in a grid-based system (like pixels on a
screen) should be plotted to form a straight line between two given points.
2. Input Points: You start with two endpoints of the line, which we can call (x0, y0) and (x1, y1).
3. Determine the Differences: Calculate the differences in the x and y coordinates:
- dx = x1 - x0
- dy = y1 - y0
4. Determine Steps: The number of steps required to draw the line can be determined by the greater
of the absolute values of dx and dy:
- steps = max(abs(dx), abs(dy))
5. Increment Values: Calculate the incremental values for x and y:
- x_increment = dx / steps
- y_increment = dy / steps
6. Plotting the Points: Start from (x0, y0) and incrementally add the calculated increments to the x
and y coordinates to plot the points of the line. You can round the coordinates to the nearest integer
to find the pixel positions.
7. Loop Until End: Continue this process until you reach the endpoint (x1, y1).
(Digital Differential Analyzer) is a line drawing algorithm used in computer graphics to generate a line
segment between two specified endpoints. It is a simple and efficient algorithm that works by using
the incremental difference between the x-coordinates and y-coordinates of the two endpoints to plot
the line.
DDA line generation algorithm are:
1. Input the two endpoints of the line segment, (x1,y1) and (x2,y2).
2. Calculate the difference between the x-coordinates and y-coordinates of the endpoints as dx
and dy respectively.
3. Calculate the slope of the line as m = dy/dx.
4. Set the initial point of the line as (x1,y1).
5. Loop through the x-coordinates of the line, incrementing by one each time, and calculate the
corresponding y-coordinate using the equation y = y1 + m(x – x1).
6. Plot the pixel at the calculated (x,y) coordinate.
7. Repeat steps 5 and 6 until the endpoint (x2,y2) is reached.
DDA algorithm is relatively easy to implement and is computationally efficient, making it suitable for
real-time applications
In any 2-Dimensional plane, if we connect two points (x0, y0) and (x1, y1), we get a line segment. But
in the case of computer graphics, we can not directly join any two coordinate points, for that, we
should calculate intermediate points’ coordinates and put a pixel for each intermediate point, of the
desired color with the help of functions like putpixel(x, y, K) in C, where (x,y) is our co-ordinate and K
denotes some color. Examples:
Input: For line segment between (2, 2) and (6, 6) :
Output: we need (3, 3) (4, 4) and (5, 5) as our intermediate points.
Input: For line segment between (0, 2) and (0, 6) :
Output: we need (0, 3) (0, 4) and (0, 5) as our intermediate points.
For using graphics functions, our system output screen is treated as a coordinate system where the
coordinate of the top-left corner is (0, 0) and as we move down our y-ordinate increases, and as we
move right our x-ordinate increases for any point (x, y). Now, for generating any line segment we
need intermediate points and for calculating them we can use a basic algorithm called DDA(Digital
differential analyzer) line generating algorithm.
DDA Algorithm: Consider one point of the line as (X0, Y0) and the second point of the line as (X1,
Y1).
// calculate dx , dy
dx = X1 – X0;
dy = Y1 – Y0;
// Depending upon absolute value of dx & dy
// choose number of steps to put pixel as
// steps = abs(dx) > abs(dy) ? abs(dx) : abs(dy)
steps = abs(dx) > abs(dy) ? abs(dx) : abs(dy);
// calculate increment in x & y for each steps
Advantages of DDA Algorithm:
It is a simple and easy-to-implement algorithm.
It avoids using multiple operations which have high time complexities.
It is faster than the direct use of the line equation because it does not use any floating point
multiplication and it calculates points on the line.
Disadvantages of DDA Algorithm:
It deals with the rounding off operation and floating point arithmetic so it has high time
complexity.
As it is orientation-dependent, so it has poor endpoint accuracy.
Due to the limited precision in the floating point representation, it produces a cumulative
error.
Xinc = dx / (float) steps;
Yinc = dy / (float) steps;
// Put pixel for each step
X = X0;
Y = Y0;
for (int i = 0; i <= steps; i++)
{
putpixel (round(X),round(Y),WHITE);
X += Xinc;
Y += Yinc;
}
Uses of DDA Algorithm: DDA (Digital Differential Analyzer) algorithm is commonly used in computer
graphics for line drawing. It has a wide range of applications, including:
1. Creating basic graphics primitives: DDA algorithm can be used to draw simple shapes such as
lines, polygons, and rectangles. By using a series of line segments generated using DDA,
more complex shapes can also be created.
2. Computer-aided design (CAD): In CAD software, DDA algorithm is used to draw lines between
two points, which are used to create 2D and 3D models.
3. Image processing: DDA algorithm can be used in image processing for tasks such as edge
detection and image segmentation.
4. Video game development: DDA algorithm is used for rendering lines and polygons in real-
time graphics rendering for video games.
5. Simulation and modeling: DDA algorithm is used to simulate physical phenomena such as ray
tracing, which is used in computer graphics to create realistic images of 3D objects.
Issues in DDA Algorithm: some limitations and issues, which are:
1. Floating point arithmetic: The DDA algorithm requires floating-point arithmetic, which can
be slow on some systems. This can be a problem when dealing with large datasets.
2. Limited precision: The use of floating-point arithmetic can lead to limited precision in some
cases, especially when the slope of the line is very steep or shallow.
3. Round-off errors: Round-off errors can occur during calculations, which can lead to
inaccuracies in the generated line. This is particularly true when the slope of the line is close
to 1.
4. Inability to handle vertical lines: The DDA algorithm is unable to handle vertical lines, as the
slope becomes undefined.
5. Slow for complex curves: The DDA algorithm is not suitable for generating complex curves
such as circles and ellipses, as it requires a large number of line segments to approximate
these curves accurately.
6. Aliasing: Aliasing occurs when the line segments generated using the DDA algorithm do not
accurately represent the line being drawn, resulting in a jagged appearance.
7. Not suitable for thick lines: The DDA algorithm generates thin lines, which can be
problematic when drawing thick lines, as the line segments may overlap or leave gaps.
Bresenham’s Line Generation Algorithm
Given the coordinate of two points A(x1, y1) and B(x2, y2). The task is to find all the intermediate
points required for drawing line AB on the computer screen of pixels. Note that every pixel has
integer coordinates. Examples:
Input : A(0,0), B(4,4)
Output : (0,0), (1,1), (2,2), (3,3), (4,4)
Input : A(0,0), B(4,2)
Output : (0,0), (1,0), (2,1), (3,1), (4,2)
Below are some assumptions to keep the algorithm simple.
1. We draw lines from left to right.
2. x1 < x2 and y1< y2
3. Slope of the line is between 0 and 1. We draw a line from lower left to upper right.
The above algorithm works, but it is slow. The idea of Bresenham’s algorithm is to avoid
floating point multiplication and addition to compute mx + c, and then compute the round
value of (mx + c) in every step. In Bresenham’s algorithm, we move across the x-axis in unit
intervals.
We always increase x by 1, and we choose about next y, whether we need to go to y+1 or
remain on y. In other words, from any position (Xk, Yk) we need to choose between (Xk + 1, Yk)
and (Xk + 1, Yk + 1).
We would like to pick the y value (among Yk + 1 and Yk) corresponding to a point that is closer to the
original line.
Circle Algorithm: Scan-Converting a circle using Bresenham's algorithm works as follows: Points are
generated from 90° to 45°, moves will be made only in the +x & -y directions as shown in fig: