Unit I : Basics of Computer Graphics
Pixel:
A pixel (short for picture element, using the common
abbreviation "pix" for "picture") is one of the many tiny dots
that make up the representation of a picture in a
computer'smemory.
The intensity of each pixel is variable; in color systems, each
pixel has typically three or four dimensions of variability
such as red, green and blue, or cyan, magenta, yellow and
black.
Resolution
• Resolution is the number of rows that appear from top to
bottom of a screen and in turn the number of pixels or pixel
elements that appear from left to right on each scanline.
• Based on this resolution only the effect of picture
appears on screen.
1) Image Resolution: It refers to pixel spacing. In normal PC
monitor it ranges between 25 to 80 pixels perinch.
2) Screen Resolution: It is thenumber of distinct pixels in
eachdimension that can be displayed.
Unit I : Basics of Computer Graphics
Text mode
• Text mode is a personal computer display setting that
divides the display screen into 25 rows and 80 columns in
order to display text without images.
• In text mode, each box can contain one character. Text
mode is also known as character mode or alphanumeric
mode. In character mode, the display screen is treated as an
array of blocks, each of which can hold one ASCII character.
Graphics Mode
Graphics mode is the more sophisticated. Programs
that run in graphics mode can display an unlimited
variety of shapes and fonts. Programs that run entirely in
graphics mode are called graphics- based programs. In
graphics mode, the display screen is treated as an array of
pixels. Characters and other shapes are formed by
turning on combinations of pixels.
Graphics Mode Graphics Function
The graphics-mode functions allow you to draw dots, lines,
and shapes (like circles, rectangles, and ellipse etc.), add
color to lines and areas, and perform many other graphics-
related activities.
Setting up Graphics Mode
detectgraph() : This function checks the system and returns
two integer parameters: a value representing the system's
graphics driver and a value for the recommended graphics
mode if an adapter is installed.
The mode value is the highest resolution possible with that
adapter. Syntax: detectgraph(int *gdriver, int *gmode);
initgraph (): This library function must be executed before any
other graphics mode functions can be used.
This requires the GRAPHICS.Hheaderfile. Syntax: initgraph(int
Unit I : Basics of Computer Graphics
*driver, int
*mode, char *path);
where *driver is the graphics driver, given by an integer.
*mode is the graphics mode, given by an integer.
Unit I : Basics of Computer Graphics
*path is a string indicating where the driver is available
note:The Driver is a file extention BGI.Each type of hardware
requires a different driver.A null string ("") indicates sriver is
in the current directory.
Graphics Pipeline
• A graphics pipeline can be divided into three main parts:
Application, Geometry and Rasterization.
The application step is executedby the software
onthemainprocessor(CPU), it cannot be divided into individual
steps, which are executed in a pipelined manner. However, it is
possible to parallelize it on multi-core processors or multi-processor
systems. In the application step, changes are made to the scene as
required, for example, by user interaction by means of input
devices or during an animation. The new scene with all its
primitives, usually triangles, lines and points, is then passed on to
the next step in the pipeline.
The geometry step (with Geometry pipeline), which is responsible
for the majority of the operations with polygons and their vertices
(with Vertex pipeline), can be divided into the following five tasks. It
depends on the particular implementation of how these tasks are
Unit I : Basics of Computer Graphics
organized as actual parallel pipeline steps.
Unit I : Basics of Computer Graphics
The Rasterization step is the task of taking an image described
in a vector graphics format (shapes) and converting it into a
raster image (pixels or dots) for output on a video display or
printer, or for storage in a bitmap file format. It refers to both
rasterization of models and 2D rendering primitives such as
polygons, line segments, etc.
Bitmap based Graphics
Bitmap (or raster) images are stored as a series of tiny dots
called pixels. Each pixel is actually a very small square that is
assigned a color, and then arranged in a pattern to form the
image. When you zoom in on a bitmap image you can see the
individual pixels that make up that image. The three most
popular image formats used on the Web(PNG, JPEG, and GIF)
are bitmap formats. The bitmap format is excellent for creating
backgrounds and overlay elements.
Vector based graphics
Vector images are not based on pixel patterns, but instead use
mathematical formulas to draw lines and curves that can be
combined to create an image from geometric objects such as
circles and polygons. All major browsers support the SVG
(Scalable Vector Graphics) format. Vector graphics are more
flexible than bit-maps because they can be easily re-sized.
Vector-based graphics can be very useful when creating large
illustrations, as these graphics are resolution independent.
Applications of Computer Graphics
Unit I : Basics of Computer Graphics
• Computer graphics user interfaces (GUIs) − A graphic,
mouse-oriented paradigm which allows the user to interact
with a computer.
• Business presentation graphics −"A picture is worth
athousand words".
Unit I : Basics of Computer Graphics
• Cartography − Drawing maps.
• Weather Maps − Real-time mapping, symbolic
representations.
• Satellite Imaging − Geodesic images.
• Photo Enhancement − Sharpening blurred photos.
• Medical imaging − MRIs, CAT scans, etc. - Non-
invasive internal examination.
• Engineering drawings − mechanical, electrical, civil, etc. -
Replacing the blueprints of thepast.
• Architecture − Construction plans, exterior sketches -
replacing the
blueprints and hand drawings of the past.
• Art − Computers provide a new medium for artists.
• Entertainment − Movies and games.
• Simulation andmodeling −Replacingphysicalmodelingand
enactments
RASTER-SCAN DISPLAYS
In a raster scan system, the 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 a pattern of illuminated spots.
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
Unit I : Basics of Computer Graphics
shown in the following illustration.
Unit I : Basics of Computer Graphics
Each screen point is referred to as a pixel (picture element)
or pel. 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.
Random-Scan Display
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, orcalligraphic display.
Picture definition is stored as a set of line-drawing
commands in an area ofmemory 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
Unit I : Basics of Computer Graphics
component line in turn.
Unit I : Basics of Computer Graphics
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 eachsecond.
Flat Panel Display
The term flat–panel displays refers to a class of video
devices that have reduced volume, weight, and power
requirements compared to a CRT. A significant feature of
flat-panel displayed is that they are thinner than CRTs, and
we can hang them on walls or wear them on our wrists.
Flat-panel displays into two categories: emissive displays and
nonemissive displays.
The emissive displays are devices that displays, and light-
emitting diodes are examples of emissive displays.
Nonemissive displays use optical effects to convert sunlight
or light from some other source into graphicspatterns.
Unit I : Basics of Computer Graphics
Light-emitting diode (LED)
A matrix of diodes is arranged to form the pixel positions in the
display, and picture definition is stored in refresh buffer. As in scan-
line refreshing of a CRT, information is read from the refresh buffer
and converted to voltage levels that are applied to the diodes to
produce the light patterns in the display.
• The working of the LED depends on the quantum theory.The
energy of the photons is equal to the gap between the higher
and lower level.
• The LED is connected in the forward biased, which allows the
current to flows in the forward direction. The flow of current
is because of the movement ofelectrons in the opposite
direction.
• The recombination shows that the electrons move from the
conduction band to valence band and they emit
electromagnetic energy in the form of photons. The energy of
photons is equal to the gap between the valence and the
conduction band.
Applications of Light Emitting Diodes
• used as a bulb in the homes andindustries
• used in the motorcycles and cars
• used in the mobile phones to display the message
• At the traffic light signals.
Advantages of LED’s
• The cost of LED’s is less and they are tiny.
• By using the LED’s the electricity is controlled.
• The intensity of the LED differs with the help of the
Unit I : Basics of Computer Graphics
microcontroller.
• The LED are available which emits light in the different
colors like red, yellow, green and amber.
Unit I : Basics of Computer Graphics
Disadvantages of LED
• The LED consumes more power as compared to LCD, and
their cost is high. Also, it is not used for making the large
display.
Liquid-crystal display (LCD)
• It is combination of two states of matter, the solid and the liquid.
• LCD uses a liquid crystal to produce a visible image.
• LCD commonly used in systems, such as calculators and
portable, laptop computers.
• The basic structure of LCD should be controlled by changing
the applied current.
• We must use a polarized light.
• Liquid crystal should able be to control both of the operation
to transmit orcan also able to change the polarized light.
Advantages of an LCD’s:
• LCD’s consumes less amount of power compared to CRT and LED
• LCDs are of low cost
• Provides excellent contrast
• LCD’s are thinner and lighter when compared to cathode ray tube
and LED
Disadvantages of an LCD’s:
• Require additional light sources
• Range of temperature is limited for operation
• Low reliability
• Speed is very low
Unit I : Basics of Computer Graphics
Applications of Liquid Crystal Display
Unit I : Basics of Computer Graphics
• Liquid crystal thermometer ,Optical imaging, Used in the
medical applications
Plasma Display Panel
• A plasma display is a type of flat panel display .
• Plasma displays are also known as gas-plasmadisplays.
• A plasma display panel (PDP) is a type of flat panel display
common to large TV displays 30 inches (76 cm) orlarger.
• They are called "plasma" displays because they
use small cells containing electrically charged ionized
gases, which are plasmas.
• Plasma displays are thinner than cathode ray tube ( CRT )
displays and brighter than liquid crystal displays (LCD).
Touch Screen
• A touch screen is a computer display screen that is also an
input device. The screens are sensitive to pressure; a user
interacts with the computer by touching pictures or words on
the screen.
• There are three types oftouch screen technology:
Resistive
Surface wave
Capacitive
Output
primitives
• The Primitives are the simple geometric functions that are
used to generate various Computer Graphics required by the
User. Some most basic Output primitives are point-position
(pixel), and a straight line.
• Line, polygon , marker , text.
Line Attributes
• A straight-line segment can be displayed with three basic
attributes: color, width, and style. Additionally, lines may be
generated with other effects, such as pen and brush strokes.
Unit I : Basics of Computer Graphics
• To set line type attributes in a PHICS application program, a
user invokes the function :setLinetype (It)
Unit I : Basics of Computer Graphics
where parameter It is assigned a positive integer value of 1,2,3,
or 4 to generate lines that are, respectively, solid, dashed,
dotted, or dash-dotted.
Marker Attributes
A marker symbol display single character in a different
color and in different sizes.
We select marker type using the function. setMarkerType (mt)
Where marker type parameter mt set to an integer code.
Typical codes for marker type are the integers 1 through 5,
specifying, respectively, a dot (.), a vertical cross (+), an
asterisk (*), a circle (o), and a diagonal cross (x). Displayed
marker types centered on the marker coordinates.
Text Attributes
The attributes that can be assigned to text are common
knowledge nowadays: Font (e.g. Courier, Arial, Times, Broadway,
…), style (normal, bold, italic, underlined, …), size, text direction,
color, alignment (left, right, centered, justified) and so on.
Attributes of Polygons
A set of line segments joined end to end.
Attributes: Fill color, Thickness, Fill pattern
Unit I : Basics of Computer Graphics
Graphics Functions
Standard graphics formats allow images to be moved from
machine to machine, while standard graphics languages let
graphics programs be moved from machine to machine. For
example, GKS, PHIGS and OpenGL are major graphics languages
. GDI and DirectX are the graphics languages in Windows.
Putpixel function is to draw the pixel on the screen. Pixel is small
dot on the screen.
Syntax:-putpixel(x co-orinate, y co-ordinate,COLOR);
Example: – putpixel(100,100,BLUE);
Rectangle function is used to draw the rectangle on the screen.
X1,y1 are the lower left co-ordinates of the rectangle and the
x2,y2 are the upper right co- ordinates of the rectangle.
Syntax:– rectangle(x1,,y1,x2,y2);
Example:– rectangle(100,100,200,200);
Line function is used to draw the line on the
screen. Syntax: line(x1,y1,x2,y2);
Example:-line(100,100,200,100);
Circle function is used to draw the circle on
thescreen Syntax:– circle(x,y,radius);
Example:-circle(100,100,50);
ellipse function is used to draw the ellipse on the
screen. Syntax:-ellipse(x, y, startingangle, ending angle,
xradius, yradius); Example:-
ellipse(100,100,90,200,20,20);
Unit I : Basics of Computer Graphics
Scan conversion
• The process of representing continuous graphics objects as a collection of
discrete pixels is called scan conversion. Scan conversion serves as a
bridge between TV and computer graphics technology.
• Scan conversion or scan converting rate is a video processing technique for
changing the vertical / horizontal scanfrequency of video signal for
different purposes and applications.
• The device which performs this conversion is called a scan converter.
• The application of scan conversion: video projectors, cinema
equipment, TV andvideo capturecards,standardandHDTVtelevisions,
LCDmonitors,radardisplaysandmany different aspects ofpicture
processing.
• There are two distinct methods for changing a picture's data rate:
• Analog Methods
(Non retentive, memory-less or real time method)
• This conversion is done using large numbers of delay cells and is
appropriate for analog video.It may also be performed using a
specialized scan converter vacuum tube.
• In this case polar coordinates (angle and distance) data from a source
such as a radar receiver, so that it can be displayed on a raster scan
(TV type) display.
• Digital methods
(Retentive or buffered method)
• In this method, a picture is stored in a line or frame buffer with n1 speed
(data rate) and is read with n2 speed.
Unit I : Basics of Computer Graphics
Frame buffer:
• Each screen pixel corresponds to a particular entry in a 2D array residing
in memory. This memory is called a frame buffer or a bit map.
• The number of rows in the frame buffer equals to the number of raster
lines on the display screen. The number of columns in this array equals to
the number of pixels on each raster line.
• Frame buffer is a large partof computer memory used to store display
image. Different kind of memory can be used for frame buffers like drums,
disk or IC – shift registers.
• To generate a pixel of desired intensity to read the disk or drum. The
information stored in disk or drum is in digital for, hence it is necessary to
convert it into analog from using DAC and then this analog signal is used to
generate the pixel.
Character Generation
• Most of the times characters are builts into the graphics display devices,
usallay as hardware but sometimes through software.
Unit I : Basics of Computer Graphics
• There are basic three methods:
Unit I : Basics of Computer Graphics
– Stroke method
– Starbust method
– Bitmap method
1. Stroke method
• This method uses small line segments to generate acharacter.
• The small series of line segments are drawn like a strokes of a pen to
form a character as shown in figure.
• We can build our own stroke method.
• By calling a line drawing algorithm.
• Here it is necessary to decide which line segments are needed for each
character and
• Then drawing these segments using line drawingalgo.
• This method supports scaling ofthe character.
• It does this by changing the length of the line segments used for character
drawing.
2. Starbust method
• In this method a fix pattern of line segments are used to generate characters.
• As shown in figure, there are 24 line segments.
• Out of 24 line segments, segments required to display for particular
character, are highlighted
• This method is called starbust method because of its characteristic appearance.
Unit I : Basics of Computer Graphics
This method of character generation has some disadvantages. They
are
1.The 24-bits are required to represent a character. Hence more memory is
required
2.Requires code conversion software to display character from its 24-bit code
3.Character quality is poor. It is worst for curve shaped characters.
3. Bitmap Method
• Also known as dot matrix because in this method characters are
represented by an array of dots in the matrix form.
• It’s a two dimensional array having columns and rows : 5 X 7 as shown in
figure.
• 7 X 9 and 9 X 13 arrays are also used.
• Higher resolution devices may use character array 100 X 100.