Unit 1 CG Notes
Unit 1 CG Notes
Sub topics:
1. Images and objects , pixels and resolution , Text Mode and Graphics mode ,
Basic graphics pipeline , Bitmap and vector based graphics , applications of CG.
2. Display devices , Raster scan display , Random scan Display , Flat panel display ,
LED , LCD Display , plasma , touch screen .
3. Output primitives: line , polygon , marker , text .
4. Graphics function and standards
5. Latest trends in computer graphics: virtual reality , augmented reality.
Introduction:
Computer graphics is an art of drawing pictures ,lines,circle,charts etc.using computers with the help of
programming.
The computer is an information processing machine. graphical objects convey more information in less
time.
So,using computers we can display the information to the users in the form of graphical objects such as
pictures,graphs,charts etc.
Computer graphics involve display, manipulation and storage of pictures for proper visualization by
using computer.
Definition:
“Computer graphics is a field of computer science that is concerned with digitally synthesizing and
manipulating visual contents.”
Computer graphics
Image is under the control of user image is not under the control of user.
Computer graphics is the study of techniques to improve communication between human and
machines.
1 . 1 Image:
“An image is a representation of an object on a computer.”
An image is a picture that has been created or copied and stored in electronic form.
An image may be an actual picture display , a page stored in a video memory , or a source code
obtained from a program.
Objects:
Object is a thing that has physical existance.
Object is an entity (person,bucket,tree)that can be customizzed using propertise like color ,length,and
behavior(animation schemes).
Computer graphics deal with both 2D and 3D descriptions of an object that performs transformations
generating visual displays.
Object manipulation gives a better flexibility for generalization at the cost of complexity of operation
Pixels:
A pixel is the smallest piece of information in an image.
“ In computer graphics , pictures are represented as a collection of discrete picture element called as
pixels.”
Each pixel is a sample of an original image, where more samples typically provide a more accurate
representation of the originals.
Rasterization:
“the process of determining the appropriate pixels for representing pictures or objects is called as
rasterization”.
Scan conversion :
The process of representing continuous pictures as a graphical object is called as scan conversion.
Resolution:
Resolution is the number of pixels contained on a display monitor, expressed in terms of the number of
pixels on the horizontal axis and the number of pixels on the vertical axis.
The resolution can be defined in many ways.such as pixel resolution ,spatial resolution,temporal
resolution ,spectral resolution.
Pixel resolution:
In pixel resolution ,the term resolution refers to the total number of counts of pixels in a digital
image.for example if an image has m rows and n columns then its resolution can be m*n.
Eg.800*600
1200*400
1 . 2 Modes of resolution:
Many video adapters support several different modes of resolution.
2. Graphics mode
1. Text mode:
A video mode in which a display screen is divided into rows and columns of boxes .
All video standards for the PC ,including VGA ,supports a text mode that divides the screen into 25
rows and 80 columns.
Display screen is treated as an array of blacks,each of which can hold one ASCII character.
25 rows
80 columns
Graphics modes:
In addition to text mode,most video adapters support a graphics mode,in which the display
screen is divided into an array of pixels.
Each pixel has a name or address,so that we can uniquely indentify that.
Computer graphics images are made by setting the intensity and color of pixels.
Programs that run entirely in graphics mode called graphics based programs.
Characters and other shapes are formed by turning a combination of pixels.
……………………………
……………………………
…………………………… 480
……………………………
...
640
programs that run in graphics mode can display an unlimited variety of shapes and fonts.
Whereas programs running in text mode are severely limited.
Application stage
Geometry stage
Rasterization
graphics pipeline or rendering pipeline defines the primitive operations required for mapping
3D scenes on a 2D screen.
1. Application stage:
• At this stage user interacts with the scene and alters it as per his requirements . These changes
must be reflected with the screen.
• The new scenes with its primitive shape like a point , line , triangles are passed to the
next stage.
• Application stage mostly performs the collision , detection , morphing , animation ,
quadtree or octree generation. It helps to reduce memory requirements.
2. Geometry stage:
a. Objects are first created in world coordinates with their actual dimensions.
b. Required objects are placed in the world co ordinate system.
c. Camera position is determined in a world co ordinate system , which determines the
view of placed objects.
Lightning:
Projection:
Parallel or perspective projection transforms the 3D scene from the real world to 2D
representation as per the camera viewing direction.
Clipping:
The real world scene which is outside the clipping window will be rejected to reduce the
further computation.
The projected and the clipped scene is then mapped to the desired device or display device.
3. Raserization:
• Each object is first converted into triangles via the process called tessellation.
• In the later stage , triangles are converted into the smallest fragments called pixels.
• Entire continuous scene is drawn in a discrete form on a monitor through the process of
rasterization.
• Color of the pixel is determined by the light source , viewing directions , object material
property etc.
• Finally output is merged and displayed on the monitor.
The image displayed on a computer monitor is also a bitmap as are the outputs of
printers,scanners and similar devices.
1. Presentation graphics
2. 2 . Entertainment
3. 3 . Education and training
4. 4 . Computer aided design(CAD)
5. Drawing and art
6. 6.communication
7. 7.Image processing
8. 8.Graphical user interface (GUI)
1.Presentation graphics:
2.Entertainment:
Nowdays, computers are being used to create realistic special effects through digital imaging,
animation ,morphing,replacement and background sound.
Morphing:
Is a graphical technique in which one object is transformed into another in such a way that the
change appears to be smooth and not rapid.
Animation:
Major use of computer graphics is in design processes for engineering and architectural systems.
CAD is used in the design of buildings,automobiles,aircraft,watercraft,spacecraft,textiles etc.
Real time animations are useful for testing performance of a vehicle or system.
Circuits, networks for communications,water supply are constructed with repeated placement
of a few graphical shapes.
6. Communication:
With videoconferencing two people or more than two people can communicate with each other
without being physically present at a common place.
Reduces pollution as unnecessary travel eliminated.
Eg. Email
7.Image processing:
It applies techniques to modify or interpret existing pictures such as photographs and TV scans.
Two principal applications of image processing are:
A major component of graphical interface is a window manager that allows a user to display
multiple window areas.
Each window contain different process that can contain graphical or non graphical displays.
Interface also display menus, icons for fast selection of processing options or parameter values.
Eg.Adobe photoshop .
2.Graphics devices :
Although early applications in engineering and science had to rely on expensive equipment ,
recent advances in computer technology have made interactive computer graphics a practical
tool.
Computer graphics started with the display of data on hardcopy plotters and cathode ray tube
(CRT) screens .
Since then it has grown to include the creation , storage and manipulation of models and images
of objects.
Computer graphics today is largely interactive.
The user controls thee contents , structure and appearance of objects and their displayed
images by using input devices , such as keyboard , mouse or any touch sensitive panels on the
screen .
Because of the close relationship between the input devices and display , the handling of such
devices is included in the study of computer graphics .
Computer devices can be divided into two major categories :
1. Hardware components
2. Display system
1 . Hardware components :
The hardware components with which the user interacts to generate necessary instructions for the
creation of required graphics.
We can obtain hard copy output for our images in several formats .
For presentation we can send images files to device or service bureaus that will produce slide.
To put images on film ,we can simply photograph a scene displayed on a video monitor and we
can put our pictures on paper by directing graphics output to a printer or plotters.
The quality of the pictures obtained from a device depends on dot size and the number of dots
per inch or lines per inch.
Printers :
To produce smooth characters in printed text strings higher quality printers shift dot positions
so that adjacent dots overlap.
Printers produce output by either impact or non impact mathods.
Impact printers press formed character faces against on inked ribben onto the paper.
Eg. Line printer.
Non impact printers and plotters use laser technique , ink jet sprays to get images on the paper.
Dot matrix print head containing a rectangular array of procruding wire pins , with the number
of pins depending on the quality of printer.
Individual characters or graphic patterns are obtained by retracting certain pins so that the
remaining pins from the pattern to be printed.
Input devices:
Keyboard:
A standard known as American standard code for information interchange (ASCII) has been
developed to allow computers to encode keyboard characters.
The keyboard is an efficient device for inputting non graphic data as picture labels associated
with a graphics display.
Cursor control keys and function keys are common features of general purpose keyboards.
Function keys allows user to enter frequently used operations in a single keystoke.
Cursor control key can be used to select displayed objects or co ordinate positions by
positioning the screen cursor.
Numeric keypad included for fast entry of numeric data.
Mouse:
It is a small hand operated box with two or three buttons on the top and a ball or roller at its
bottom.
There is a cursor in the shape of an arrow always associated with a mouse.
The Potentiometer attached to the ball estimates the relative positions of the mouse.
Trackball :
Ball can be rotated with the fingers or palm of the hand to produce screen cursor movement.
The potentiometer attached to the ball , measures the amount and directions of rotation.
Spaceball :
Joystick :
A joysticks consist of a small vertical lever(stick)mounted on the base to steer the screen cursor
around.
The distance that the stick is moved in any direction from its center position corresponds to
screen cursor movement in that direction.
Potentiometer mounted at the base of the joystick measures the amount of movement and
springs return the stick to the center position when it is released.
Data glove:
Digitizers :
Image scanner :
Drawings ,graphs , color or 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.
The gradation of gray scale or color are then recorded and stored in an array.
Once we have the internal representation of a picture , we can apply transformations to rotate ,
scale or crop the picture to a particular screen area.
Light pen :
It is pencil shaped device used to select screen positions by detecting the light coming from
points on the CRT screen.
An activated light pen , pointed at a spot on the screen as the electron beam lights up the spot ,
generates an electrical pulse that causes the co ordinate position of the electron beam to be
recorded.
As with cursor positioning devices , recorded light pen co ordinates can be used to position an
object or to select a processing option.
Disadvantages :
As part of the screen image is obscured by the hand , light pen can cause arm fatigue.
Voice system:
Speech recognizers are used in some graphics workstations as input devices to accept voice
commands.
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.
Touch panel:
Touch panel allows displayed objects or screen positions to be selected with the touch of a
finger
A typical application of touch panels is for the selection of processing options that are
represented with graphical icons.
Touch input can be recorded using optical , electrical or acoustical methods.
Optical touch panel:
Optical touch panels employ a line of infrared light emitting diodes(LED’s) along one vertical
edge and along one horizontal edge of the frame.
The opposite vertical and horizontal edges contain light detecters.
These light detecters are used to record which beams are interrupted when the panel is
touched.
The two crossing beams that are interrupted identify the horizontal and vertical co ordinates of
the screen position , selected positions can be selected with an accuracy of about ¼”.
With closely spaced LED’s , it is possible to break two horizontal or two vertical beams
simultaneously.
In this case , an average position of between the two interrupted beams is recorded.
The LED’s operate at infrared frequencies ,so that the light is not visible to a user.
Advantages:
Disadvantages:
• Dust , oil or grease buildup on screen could impede light beam causing malfunction.
An electrical touch panel is constructed with two transparent plates separated by a small
distance.
One of the plates is coated with a conducting material and the other plate is coated with a
resistive material.
When the outer plate is touched , it is forced into contact with the inner plate.
These contact creates a voltage drop across the resistive plate that is converted to the co
ordinate values of the selected screen positions.
Advantages:
Disadvantages:
2. Outer polyester film is vulnerable to damage from scratching , Poking , sharp object
In acoustical touch panels , high frequency sound waves are generated in horizontal and vertical
directions across a glass plate.
Touching the screen causes part of each wave to be reflected from the finger to the emitters.
The screen position at the point of contact is calculated from a measurement of the time
interval between the transmission of each wave and its reflection to the emitter.
Advantages:
Disadvantages:
The CRT is a vaccum glass tube with the display screen at one end and connectors to the control circuits
at other end.
Phosphor is coated on the inside of the display screen which emits lights for a period of time when hit by
a beam of electrons.
The color of light and time period vary from one type of phosphor to another.
The light given off by the phosphor during exposure to the electron beam. The continuing glow given off
after the beam is removed .
Opposite to phosphor coated screen i.e. on other end there is an electron gun which is heated to send
our electrons.
The electrons are regulated by the control electrode and forced by the focusing electrode into a narrow.
Beam striking the phosphor coating at small spots. When this electron beam passes through the
horizontal and vertical deflection plates , it is bent or deflected by the electric field between the plates.
The horizontal plate controls the beam to scan from left to right and retrace from right to left.
The vertical plates control the beam to go from the first scan line at the top to the last scan line at the
bottom and retrace from the bottom back to the top.
These actions are synchronized by the control circuits so that the electron beam strike each and every
pixel position in a scan line by scan line fashion.
In color display there are 3 electron guns instead of one with one electron gun for each primary color.
The phosphor coating on the inside of the display screen consists of dot patterns of three different types
of phosphors.
The distance between the center of dot patterns is called the pitch of the color CRT. A thin metal screen
called a shadow mask is placed between the coating and electron guns.
The tiny holes on the shadow mask constrain each electron beam to hit its corresponding phosphor
dots.When viewed from a certain distance,light emitted by the 3 types of phosphors blends together to
give us a broad range of colors.
Random scan :
Display devices with random scan operate by directing the electron beam to only those parts of
the screen where the picture is to be drawn.
This is also called as vector graphics.
This vector graphics depends on the ability of hardware to generate line vectors.
Creation of diagrams using vector graphics becomes easier , so can be used in engineering and
scientific drawings , where as the raster graphics can be used in animation.
In random scan pen plotters and direct storage view tube(DVST) devices are used.
Whereas in raster scan cathode ray tube (CRT) are used.
Since , the cost of devices used for random scan much higher than the cost of devices for raster
scan , people are using raster scan devices heavily.
For random scan the host system generates a display file graphics commands which is executed
by the display processor.
The display processor then just reads the frame buffer and turns electron beams on or off.
Disadvantages:
1 . Emissive displays :
Emissive displays are devices that convert electrical energy into light.
Eg .plasma panel , thin film electroluminescent displays , light emitting diodes.
Flat CRTs have also been devised , in which electron beams are accelerated parallel to the
screen , then deflected 90 degree to the screen , but flat CRTs have not proved to be as
successful as other emissive devices.
2 . Non-emissive displays :
Uses optical effects to convert sunlight or light from some other source into graphics patterns.
Eg .LCD (liquid crystal device)
Plasma panel :
A display device which stores the image but allows selective erasing is the plasma panel.
Is also called as gas discharge displays , because it contains a neon gas at a low pressure
sandwiched between horizontal and vertical grids of fine wires.
A large voltage difference between a horizontal and vertical wire will cause the gas to glow as it
does in a neon street sign.
A lower voltage will not start a glow but will maintain a glow once started.
Normally the wires have this low voltage between them.
To set a pixel , the voltage is increased momentarily on the wires that intersect the desired
point.
To make pixel off , the voltage on the corresponding wires is reduced until the glow cannot be
maintained.
Plasma panels are very durable and are often used in military application.
Advantages:
Less volume.
Less weight.
Disadvantages:
“ A liquid crystal display is a thin, flat display device made up of any number of pixels arrayed in front
of a light source or reflector.”
-It uses very small amount of electric power , and is suitable for use in battery powered
electronic devices .
Is a temperature dependent.0-70 degree Celsius .
Advantages:
• Small size
• Low cost
Disadvantages:
• Temperature dependent.
Graphics function:
A general purpose graphics packages provides user with variety of function for creating
and manipulating pictures.
Input functions are used for control and process the various input device such as mouse
, tablet etc.
Control operations are used to controlling and housekeeping tasks such as clearing
display screen etc.
All such inbuilt functions which we can use for our purpose are known as graphic
function.
1.initgraph():-
2. closegraph():-
Syntax :
closegraph();
lineto():
syntax:
lineto(endx,endy);
line():
syntax :
line(x1,y1,x2,y2);
Eg. line(100,100,200,200);
circle():
syntax:
circle(x,y,radius);
Eg. circle(100,100,50);
rectangle():
Syntax:
rectangle(x1,y1,x2,y3);
ellipse():
Syntax:
Input 2 : x=250, y=200, start_angle = 0, end_angle = 180, x_rad = 80, y_rad = 150
drawpoly():
Syntax:
Input : arr[] = {120, 250, 400, 250, 400, 350, 450, 200, 120, 250};
setcolor():
Syntax:
setcolor(COLOR);
Eg. setcolor(RED);
setlinestyle():
Syntax :
Eg. setlinestyle(SOLID_LINE,1,2);
setfillstyle():
Graphics standards :
A good computer graphics system includes good software as well as a compatible
hardware.
Both computer graphics vendors as well as users identified some needs to have some
graphics standards.
1.software portability
CORE :
Provides standardized set of commands to control construction and display of graphics
images.
Core system defines basic graphics primitives from which more complex or special
purpose graphics routines could be built.
Program written for the core system could be run on any installation using that system.
Core system contained mechanisms for describing and displaying both 2D and 3D
structures.
It defines the format for engineering drawing that can be read or written by
applications.
Is the only standard fro graphical database specification designed to serve a wide range
of applications.
3 standardized encodings:
CGI defines the syntax and semantics of the set of elements which can be exchanged
across the virtual device interface.
Graphics standards :
Advantages:
can upgrade the graphics equipment .
Disadvantages:
There is no fixed graphics standards available and applicable to all application programs.
since every application is not having device independence property there is a lot of
problem to frame a standard.
poor definition od standards may lead to create certain problems for users.
Virtual reality :
Virtual reality is the system which prodeuce images in such way that we feel that our
surrounding is what we are set in display devices but in actually it does not.
In virtual reality user step into a scene and interact with the environment.
Examples:
1. Military
2. Mental health
3. Medical training
4.education
Augmented reality:
Is the real time use of information in the form of text,graphics,audio and other virtual
enhancements integrated with real world objects.
An artificial environment created through the combination of real world and computer
generated data.
Exapmles:
Google glass
Pokemon go