Graphical Kernel System Is
Graphical Kernel System Is
It
was adopted as first graphics software standard by International Standard Organization
(ISO). It has features for drawing in 2-dimensional vector graphics which is suitable for
charting and similar purpose. The 2-dimensional computer graphics which is closely related
to six output functions of Graphical Kernel System (GKS).
• Graphics Kernel System (GKS) was developed in Europe and was standardized in the year
1985. This was a system, which was heavily influenced by CORE's 2-dimensional graphics.
It is a standardized system of graphical functions to process graphical data for creating and
processing 2-dimensional images. Obviously, being a standard, the functions defined are
independent of the programming languages, applications and type of devices used. The
entire GKS is divided into eight categories depending upon their functionality.
PHIGS: • The Programmer's Hierarchical Interactive Graphics System (PHIGS) standard is
a graphics standard, which was accepted in 1989. PHIGS is a 3-dimensional graphics
standard. It is much similar to GKS-3D.
• However, it has a single Central Structure Storage (CSS). The CSS is a structure or a
network of objects. This is a directed graph type of structure in nature. Within this structure,
the graphics primitives and attributes are used to draw objects. Though PHIGS has a
complex hierarchical data structure, it has got high interactivity. For example, in PHIGS
a bicycle can be stored as shown in Figure below.
CRT ● CRT is a technology used in traditional computer monitors and televisions. It was
invented y Karl Ferdinand Bruan in 1897 and that was a coold cathode tube. In 1922 H.W.
Weinhart invented hot cathode tube.
● 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 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. Refresh CRT ● In the Refresh CRT (Cathode Ray Tube), there is an electron gun.
This electron gun generates an electron beam by hot cathode via thermionic emission
through heater inside. ● The electron beam generated by electron gun must be controlled in
two ways. One is its intensity and other is its position. This electron gun is located inside at
the rear side of CRT. ● The inner side of the front screen is coated with phosphor. When an
electron beam strikes this phosphor coating, it glows and we can see it on the front side of
the screen. ● Intensity means the number of electrons that should reach phosphor coating.
This is controlled by pair of control coils. ● Position means where this beam should reach
the back side of screen – the horizontal and vertical position of the electron beam. ● The
Horizontal and vertical deflections controlled by horizontal and vertical deflection coils
respectively. ● To maintain the screen picture we need some process, as the light discharged
by the phosphor fades with very high speed. ● The method we require is to keep up the
phosphor glowing is to draw up again i.e. redraw the picture repeatedly by quickly directing
this electron beam back on to the same points which were resulted in first time. This kind of
Display is called “Refresh CRT”. ● Heated Metal Cathode and Control Grid are the
components of electron gun. Heated Metal Cathode gets heated by directing “Current” using
wire coil, which is also called Filament. ● In the Cathode ray tube vacuum, already negative
charged electrons are then accelerated towards the Coating by positive voltage. ●
Accelerating voltage will be generated with a positively charged metal which is coated on
the inside of the CRT envelope near the Phosphor screen. ● Intensity of the electron beam
is controlled by setting voltage levels on the control grid, which is metal cylinder that fits
over the cathode. ● Control grid controls the brightness of a display by varying the voltage
on the grid. ● The focusing system in a CRT is needed to 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 approached the screen. ● On the Phosphor
screen, various marks or spots of light are produced on the screen by the transfer of CRT
beam energy to screen. ● After some time, the excited phosphor electrons come back to
their previous stable ground state
Color CRT ● The CRT Monitor displays 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, and additional colors
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(fast) electrons excites the inner green layer.
Thus screen shows a green color. Advantages: 1. 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. ○ It is used in the majority of color TV sets and monitors. Construction: A shadow
mask CRT has 3 phosphor color dots at each pixel position. ○ One phosphor dot emits: red
light ○ Another emits: green light ○ Third emits: blue light ○ This type of CRT has 3
electron guns, one for each color dot and a shadow mask grid just behind the phosphor
coated screen. ● Working: Triad arrangement of red, green, and blue guns. ● The deflection
system of the CRT operates on all 3 electron beams simultaneously; the 3 electron beams
are deflected and focused as a group onto the shadow mask, which contains a sequence of
holes aligned with the phosphor- dot patterns. ● When the three beams pass through a hole
in the shadow mask, they activate a dotted triangle, which occurs as a small color spot on
the screen. ● The phosphor dots in the triangles are organized so that each electron beam
can activate only its corresponding color dot when it passes through the shadow mask.
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.
LCD ● The full form of LCD is Liquid Crystal Display. LCD is a flat-panel display
system that is primarily seen in Television and computer screens, which is also used by cell
phones presently. Such LCDs are entirely different from the previous CRT displays and it
utilizes liquid crystals as their primary mode of operation rather than cathode rays.
● LCD consists of millions of pixels created from crystal and organized in a rectangular
pattern on the LCD panel. LCD has backlights that bring light to every pixel. Every pixel
has a sub-pixel (RGB), red, green & blue, which can be switched off or on. When all sub
pixels are switched off, it is black, while all sub pixels are switched on a hundred percent,
then it is white. ● Liquid Crystal Displays are the devices that produce a picture by passing
polarized light from the surroundings or from an internal light source through a liquid-
crystal material that transmits the light. ● LCD uses the liquid-crystal material between two
glass plates; each plate is the right angle to each other between plates liquid is filled. One
glass plate consists of rows of conductors arranged in vertical direction. Another glass plate
is consisting of a row of conductors arranged in horizontal direction. The pixel position is
determined by the intersection of the vertical & horizontal conductor. This position is an
active part of the screen. ● 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.
DVST(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, thus avoiding the need to
rewrite the image constantly. ● 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 the picture is to be modified, then time is consumed.
Raster scan and Random Scan Display
● Raster scan and Random Scan are the popular approaches used to demonstrate the picture
of an object on the screen. Raster Scan Display
● Raster scanning is a technique for generating or recording a video image by means of a
line-by-line sweep. Television and printers are using raster scan methods. Most common
graphics monitor using CRT are raster scan displays. In them, the electron beam is swept
from top to bottom, one row at a time. As electron beam moves across each row, the beam
intensity is turned on or off to create pattern. This scanning is also known as non-interlaced
scanning. ● Picture definition is stored in memory area called the Refresh Buffer or
Frame Buffer. This memory area holds the set of intensity values for all the screen points.
Stored intensity values are then retrieved from the refresh buffer and “painted” on the screen
one row (scan line) at a time as shown in the following illustration. ● Each screen point is
referred to as a pixel (picture element) or pel. ● Intensity range of pixel positions depends
on the capability of the raster system. In simple black –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. For bit level system, a bit value of 1 indicates that electron beam is to be turned
on at that position and 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. ● On
the black and white system with one bit per pixel, the frame buffer is commonly called a
bitmap. For system with multiple bits per pixel, the frame buffer is often referred to as a
pixmap. ● Refreshing on raster –scan displayed is carried out at the rate of 60 to 80 frames
per second. ● Although some systems are designed for higher refresh rates. Sometimes
refresh rate are described in units of cycles per second or Hertz (Hz), where a cycle
corresponding to 1 frame. ● 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. The return to the left of the
screen, after refreshing each scan line is called horizontal retrace of the electron beam. And
at the end of each frame to the top left corner of the screen to begin the next frame is called
vertical retrace. Types of Scanning or travelling of beam in Raster Scan 1. Interlaced
Scanning 2. Non-Interlaced Scanning ● In Interlaced scanning, each horizontal line of the
screen is traced from top to bottom. Due to which fading of display of object may occur.
This problem can be solved by Non-Interlaced scanning. In this first of all odd numbered
lines are traced or visited by an electron beam, then in the next circle, even number of lines
are located. For non-interlaced display refresh rate of 30 frames per second is 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 Display
● The random scan is a technique in which the display is constructed through an electron
beam, which is directed only to the specific areas of the screen where the image is to be
sketched or drawn. The resolution of the random scan display is high, and thus it delivers
smooth image drawing. One of the most attractive pointers about the random scan is that it
requires less memory. However, the colour range is minimal here. ● In this technique, the
electron beam is directed only to the part of the screen where the picture is to be drawn
rather than scanning from left to right and top to bottom as in raster scan. It is also called
vector display, stroke-writing display, or calligraphic display. ● Picture definition is stored
as a set of line-drawing commands in an area of memory referred to as the refresh display
file. To display a specified picture, the system cycles through the set of commands in the
display file, drawing each component line in turn. After all the line-drawing commands are
processed, the system cycles back to the first line command in the list. ● Random-scan
displays are designed to draw all the component lines of a picture 30 to 60 times each
second. ● Random scan systems are designed for line –Drawing applications and cannot
display realistic shaded scenes. Since picture definition is stored as a set of line –Drawing
instructions and not as a set of intensity values for all screen points, vector displays
generally have higher resolution than Raster Scan system. Also, vector displays produce
smooth line drawings because the CRT beam directly follows the line path. A raster system
produces jagged lines that are plotted as discrete point sets. DDA Algorithm-
DDA Algorithm is the simplest line drawing algorithm. Given the starting and
ending coordinates of a line,
DDA Algorithm attempts to generate the points between the starting and ending
coordinates.
Procedure-
Given-
Starting coordinates = (X0, Y0)
Ending coordinates = (Xn, Yn)
The points generation using DDA Algorithm involves the following steps-
Step-01:
Calculate ΔX, ΔY and M from the given input.
These parameters are calculated as-
ΔX = Xn – X0
ΔY =Yn – Y0
M = ΔY / ΔX
Step-02:
Find the number of steps or points in between the starting and ending coordinates.
if (absolute (ΔX) > absolute (ΔY))
Steps = absolute (ΔX);
else
Steps = absolute (ΔY);
Step-03:
Suppose the current point is (Xp, Yp) and the next point is (Xp+1, Yp+1).
Find the next point by following the below three cases-Step-04:
Keep repeating Step-03 until the end point is reached or the number of generated new points
(including the starting and ending points) equals to the steps count.
Digital Differential Analyzer DDADDA algorithm is the simple line generation
algorithm which is explained step by step here.
Step 1 − Get the input of two end points (X0,Y0)(X0,Y0) and (X1,Y1)(X1,Y1).
Step 2 − Calculate the difference between two end points.
dx = X1 - X0
dy = Y1 - Y0
Step 3 − Based on the calculated difference in step-2, you need to identify the
number of steps to put pixel. If dx > dy, then you need more steps in x coordinate;
otherwise in y coordinate.
if (absolute(dx) > absolute(dy))
Steps = absolute(dx);
else
Steps = absolute(dy);
Step 4 − Calculate the increment in x coordinate and y coordinate.
Xincrement = dx / (float) steps;
Yincrement = dy / (float) steps;
Step 5 − Put the pixel by successfully incrementing x and y coordinates accordingly
and complete the drawing of the line.
for(int v=0; v < Steps; v++)
{
x = x + Xincrement; y = y + Yincrement;
putpixel(Round(x), Round(y));
}
Advantages of DDA Algorithm-
The advantages of DDA Algorithm are-
It is a simple algorithm.
It is easy to implement.
It avoids using the multiplication operation which is costly in terms of time complexity.
Disadvantages of DDA Algorithm-
The disadvantages of DDA Algorithm are-
There is an extra overhead of using round off( ) function.
Using round off( ) function increases time complexity of the algorithm.
Resulted lines are not smooth because of round off( ) function.
The points generated by this algorithm are not accurate.
Example: If a line is drawn from (2, 3) to (6, 15) with use of DDA. How many points
will needed to generate such line?
Solution: P1 (2,3) P11 (6,15)
x1=2 y1=3 x2= 6 y2=15 dx = 6 - 2 = 4 dy = 15 - 3 = 12 m = dy/dx =12/4
For calculating next value of x takes x = x +1/m
Bresenham Line Drawing Algorithm-The Bresenham algorithm is another
incremental scan conversion algorithm. The big advantage of this algorithm is that,
it uses only integer calculations. Moving across the x axis in unit intervals and at
each step choose between two different y coordinates. For example, as shown in
the following illustration, from position 2,32,3 you need to choose between 3,33,3
and 3,43,4. You would like the point that is closer to the original line. At sample
position Xk+1,Xk+1, the vertical separations from the mathematical line are labelled as
dupperdupper and dlowerdlower. Procedure-
Given-
Starting coordinates = (X0, Y0)
Ending coordinates = (Xn, Yn)
The points generation using Bresenham Line Drawing Algorithm involves the following
steps-
Step-01:
Calculate ΔX and ΔY from the given input.
These parameters are calculated as-
ΔX = Xn – X0
ΔY =Yn – Y0
Step-02:
Calculate the decision parameter Pk.
It is calculated as-
Step-03:
Suppose the current point is (Xk, Yk) and the next point is (Xk+1, Yk+1).
Find the next point depending on the value of decision parameter Pk.
Step-04:
Keep repeating Step-03 until the end point is reached or number of iterations equals to (ΔX-
1) times.
PRACTICE PROBLEMS BASED ON BRESENHAM LINE DRAWING
ALGORITHM-
Problem-01:
Calculate the points between the starting coordinates (9, 18) and ending coordinates (14,
22).
Solution-
Given-
Starting coordinates = (X0, Y0) = (9, 18)
Ending coordinates = (Xn, Yn) = (14, 22)
Step-01:
Calculate ΔX and ΔY from the given input.
ΔX = Xn – X0 = 14 – 9 = 5
ΔY =Yn – Y0 = 22 – 18 = 4
Step-02:
Calculate the decision parameter.
Pk
= 2ΔY – ΔX
=2x4–5
=3
So, decision parameter Pk = 3
Step-03:
As Pk >= 0, so case-02 is satisfied.
Thus,
Pk+1 = Pk + 2ΔY – 2ΔX = 3 + (2 x 4) – (2 x 5) = 1
Xk+1 = Xk + 1 = 9 + 1 = 10
Yk+1 = Yk + 1 = 18 + 1 = 19
Similarly, Step-03 is executed until the end point is reached or number of iterations equals
to 4 times.
(Number of iterations = ΔX – 1 = 5 – 1 = 4)
Advantages of Bresenham Line Drawing Algorithm-
The advantages of Bresenham Line Drawing Algorithm are-
It is easy to implement.
It is fast and incremental.
It executes fast but less faster than DDA Algorithm.
The points generated by this algorithm are more accurate than DDA Algorithm.
It uses fixed points only.
Disadvantages of Bresenham Line Drawing Algorithm-
Though it improves the accuracy of generated points but still the resulted line is not
smooth.
This algorithm is for the basic line drawing.
It can not handle diminishing jaggies.
Flood Fill Algorithm [FloodFill (seedx, seedy, fcol, dcol)]
(4 connected neighborhood point)
Step-1: Initialize the value of seed point (seedx, seedy), fcolor
and dcol.
Step-2: Define the boundary values of the polygon.
Step-3: Check if the current seed point is of default color then repeat
the steps 4 and 5 till the boundary pixels reached
If getpixel(x,y) = dcol then repeat step 4 and 5
Step-4: Change the default color with the fill color at the seed
point.
setPixel(seedx, seedy, fcol)
Step-5: Recursively follow the procedure with four neighborhood points.
FloodFill (seedx – 1, seedy, fcol, dcol)
FloodFill (seedx + 1, seedy, fcol, dcol)
FloodFill (seedx, seedy - 1, fcol, dcol)
FloodFill (seedx – 1, seedy + 1, fcol, dcol)
Step-6: Exit
(8 connected neighborhood point)
Step-1: Initialize the value of seed point (seedx, seedy), fcolor
and dcol.
Step-2: Define the boundary values of the polygon.
Step-3: Check if the current seed point is of default color then repeat
the steps 4 and 5 till the boundary pixels reached
If getpixel(x,y) = dcol then repeat step 4 and 5
Step-4: Change the default color with the fill color at the seed
point.
setPixel(seedx, seedy, fcol)
Step-5: Recursively follow the procedure with four neighborhood
points.
FloodFill (seedx – 1, seedy, fcol, dcol)
FloodFill (seedx + 1, seedy, fcol, dcol)
FloodFill (seedx, seedy - 1, fcol, dcol)
FloodFill (seedx, seedy + 1, fcol, dcol)
FloodFill (seedx – 1, seedy + 1, fcol, dcol)
FloodFill (seedx + 1, seedy + 1, fcol, dcol)
FloodFill (seedx + 1, seedy - 1, fcol, dcol)
FloodFill (seedx – 1, seedy - 1, fcol, dcol)
Step-6: Exit