51 graphics and multimedia cg
TRANSCRIPT
-
8/13/2019 51 Graphics and Multimedia CG
1/70
PAREREQUISITES
This course is part of Information Technology program (B.Sc. (IT)) of
Kuvempu University.
A student registering for the fifth semester of B.Sc. (IT) of Kuvempu
University must have completed the fourth semester of B.Sc.(IT). The
student should have attained the knoledge of the folloing modules!
Algorithms
"ava #rogramming
Uni$ % Shell #rogramming
Softare &ngineering
'IIT oordinator *uide + *raphics and ,ultimedia -
-
8/13/2019 51 Graphics and Multimedia CG
2/70
CHAPTER-SPECIFIC INPUTS
Chapter One
ObjectivesIn this chapter the students have learned to!
Identify the need for computer graphics
/iscuss the/iscuss thehistory of computer graphics
Identify the applications of computer graphics
Focus Areas
Introduce computer graphics as a revolutionary development in the field ofcomputer sciences. Tell the students that 0illiam 1etter invented the term
computer graphics in -234. &$plain the term computer graphics folloed
5y the history of computer graphics hardare.
onduct an open discussion on the applications of computer graphics. 6ou
may discuss the applications of computer graphics discussed in the
Additional Inputs sectionInputs section.
e$t discuss operating system support for graphics. 1inally discuss
programming language support for graphics. Inform the students that they
ill learn to use programming for creating graphics as a part of thiscurriculum.
Aitiona! Inputs
The folloing section provides some e$tra inputs on the important topics
covered in the S*!
Histor" o# Co$puter %raphics - Interestin& Facts
The folloing ta5le lists the various events in the history of computer
graphics!
Event Year
First computer animation film 1961
First video game Spacewar 1961
First computer model of a human
figure
1964
7 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
3/70
First home video game named
Odyssey, which allowed users to
move points around a screen
1966
Fracta!s
,ost graphic packages allo you to create simple graphics using lines
polygons and curves easily. 8oever these 5asic tools cannot help you in
creating clouds trees or for that matter the 9a::y patterns in the A;S used
in audio softare such as 0inamp or the latest 0indos ,edia #layer.
Such real
-
8/13/2019 51 Graphics and Multimedia CG
4/70
?pen*@ is a knon and highly used Application #rogramming Interface
(A#I) for creating 7/ and >/ graphics hich has 5ecome a de
-
8/13/2019 51 Graphics and Multimedia CG
5/70
2. /efine computer graphics and Interactive computer graphicsD
Ans.
omputer graphics can 5e defined as the use of computers to define store
manipulate interrogate and present pictorial output of the data.Interactive computer graphics refers to devices and systems that facilitate
the man. Briefly narrate the history of graphics hardare technologyD
Ans.
In early days the high cost of the hardare for computer graphics
remained the o5stacle hich prevented their idespread use. omputers
have 5een getting progressively more ine$pensive and it has 5ecome a
household article these days. The microelectronics revolution and the
su5se=uent reduction in the price of the digital hardare have completely
changed the situation. /ue to this price reduction it is no realistic to
e$pect that all computers ith graphic display hardare capa5ility ill 5e
making e$tensive use of computer graphics.
The announcement of the IB, personal computer using -3
-
8/13/2019 51 Graphics and Multimedia CG
6/70
performed 5y the #U. 8oever an accelerator is not programma5le. It is
a functioned processor hich caries out specific tasks hard4-4
3 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
7/70
. "ustify the statement 0indos ?S is so popularD
Ans.
The 0indos ?S is popular 5ecause it supports a graphical user interface
(*UI) in hich users can perform operations ith the help of graphicalo59ects such as indos and 5uttons. Apart from an intuitive *UI it
supports various other features such as support for integrated application
environment multitasking multimedia and netorking.
#. 0hat are the strengths of UIJ operating systemD
Ans.
The Uni$ operating system has 5een knon and popular as a simple small
porta5le poerful time
-
8/13/2019 51 Graphics and Multimedia CG
8/70
11.ame the omputer languages that support omputer *raphics.
Ans.
Some languages that support computer graphics are!a. 1?TA
5. BASI
c. #ASA@
d.
E oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
9/70
12. Wh * language is popular for graphics programming?
Ans.
* has become a choice for toda3s professionals, developers for
graphics programming. * is a structured language and is rich inexpressive power and applicable to a wide variet of users. 4ecause of
the rich set of graphical functions available, this language helps in
designing for graphical applications. !he * code is small, fast,
portable, and flexible.
FAQ
1. 0hat are real time computer graphicsD
Ans5
eal time graphics deal ith producing images in real time. An e$ample of
real time graphics is creating scenes for video games. They are used in
simulating real life actions. 1or this reason they are used e$tensively in the
entertainment industry.
2. 0hat is omputer
-
8/13/2019 51 Graphics and Multimedia CG
10/70
The mechanism called *, (omputer *raphics ,etafiles) provides for
the e$change of pictures 5eteen applications. It supports 5itmap facility
for the creation and manipulation of graphics images.
-4 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
11/70
Chapter T+o
Objectives
In this chapter the students have learned to!
/escri5e graphics hardare components and softare packages
/efine interactive graphics
ompare raster and random display systems
Use graphical input devices and interactive techni=ues
Identify graphical user interface design techni=ues
Focus Areas
Introduce the term interactive computer graphics to students. Tell them thatinteractive graphics need special hardare to function. Ask students to
identify graphics components that can 5e used for interactive graphics.
&$plain the various characteristics of displays such as aspect ratio
resolution refresh rate and interlacing.
&$plain the concept of random and raster scanning in displays. &$plain the
various types of display technologies. efer to the 1ocus Areas section and
e$plain the difference 5eteen raster and vector images. Initiate a
discussion on the comparison 5eteen various types of displays.
Aitiona! Inputs
The folloing section provides some e$tra inputs on the important topics
covered in the S*!
Raster vs ,ector %raphics
aster images are stored as pi$els. ?nce created and saved in a
raster(5itmapped) form an image can 5e edited 5y altering individual
pi$els through 5itmap creation and editing packages such as #hotoshop.8oever these images cannot 5e scaled ithout losing =uality. If you
scale a raster graphic it Fpi$alatesF that is the individual pi$els 5egin to
sho up and the =uality of the image is lost.
*iven here are the to versions of the same image < one in normal si:e and
another magnified!
'IIT oordinator *uide + *raphics and ,ultimedia --
-
8/13/2019 51 Graphics and Multimedia CG
12/70
Unlike raster images vector or random images are made up and stored as
geometric shapes. These can 5e scaled ithout loss of =uality and can 5e
easily edited in packages such as Ado5e Illustrator. The folloing image
shos an image created and magnified to >744L in Ado5e Illsutrator.
-7 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
13/70
aster graphics are used commonly on the 0e5 or for normally displaying
on computers 5ecause in this case the high =uality and si:e of vector
graphics is not re=uired. ;ector graphics are not suita5le for use on the
0e5 5ecause vector file formats are not idely supported 5y 5rosers
(e$cept 1lash hich is also a vector 5ased format). The high =uality vector
graphics are more suita5le for creating graphics such as logos and
5rochures here =uality is a prime concern.In some cases such as logos here you may ant to use the same graphic
for the 0e5 as ell as printing you can create a vector graphic and import
it as a raster graphic for the 0e5 and retain the original vector format copy
also. In this ay you ill also 5e a5le to make changes to the image easily.
This kind of functionality is supported in Illustrator and #hotoshop here
you can import an illustrator graphic in #hotoshop.
'IIT oordinator *uide + *raphics and ,ultimedia ->
-
8/13/2019 51 Graphics and Multimedia CG
14/70
Settin& )isp!a" Properties
6our operating system lets you set the properties of your monitor as
re=uired. In 0indos you can set the display properties 5y performing the
folloing steps!
-. ight. Select a resolution using the Screen Area slider. The resolutions shon
in the slider depends on the si:e of your monitor. The si:e of a monitor
is specified as its diagonal length. The folloing ta5le shos
recommended si:e 5ased on the monitor si:e!
Monitor
Size
Recommended Resolutions
14 8 ! 6
1" 1#4 ! $68
1$ 1#4 ! $68 or 11"# ! 864
-C oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
15/70
19 11"# ! 864 or 1#8 ! 96
#1 1#8 ! 96
'IIT oordinator *uide + *raphics and ,ultimedia -G
-
8/13/2019 51 Graphics and Multimedia CG
16/70
C. lick the Advanced 5utton. A dialog 5o$ opens. avigate to the
,onitor ta5 in this dialog 5o$ as shon in the folloing figure!
G. &nsure that the 7ide modes that this monitor cannot displa
check5o$ is selected. o select an appropriate refresh rate from the
efresh 1re=uency drop
-
8/13/2019 51 Graphics and Multimedia CG
17/70
3. lick ?K in the dialog 5o$ to apply the selected refresh rate and then
click ?K in the /isplay #roperties dialog 5o$ to close it and apply the
settings.
ore )isp!a" Characteristics
Apart from resolution refresh rate and aspect ratio some other
characteristics of monitors include!
8iewing angle! It is the ma$imum angle at hich you can vie amonitorFs display ithout any reduction in 5rightness or color of the
image. ,ost T monitors support a vieing angle of -E44. That is
even hen you are standing at an angle of -E4 degrees to a T
monitor you can vie it ithout any loss of color of 5rightness.
8oever if you try vieing a laptop from an angular position you ill
see the display darker than hen you vie it from the normal position
of 244. @/ displays do not support good vieing angles.
+ot pitch! It is the distance 5eteen the phosphor dots on a monitor
hich have the same color. This distance is measured diagonally ande$pressed in millimeters. It is desira5le to have a lo dot pitch for
sharper image display.
)ixel pitch! It is the distance 5eteen the centers of to ad9acent
pi$els usually e$pressed in millimeters.
*ontrast ratio! It is ratio 5eteen the 5rightest hite and darkest 5lack
in a monitor. It is evaluated as!
Brightness at the center of the monitor hen all pi$els are hite
Brightness at the center of the monitor hen all pi$els are 5lack 9esponse time! It is a characteristic of @/ monitors hich is related
to the frame rate of the @/ monitor. A high response time means that
'IIT oordinator *uide + *raphics and ,ultimedia -H
-
8/13/2019 51 Graphics and Multimedia CG
18/70
the monitor can display full motion movies ithout any pro5lems. This
characteristic does not apply to T monitors 5ecause they have the
capa5ility of displaying full motion video ithout any pro5lems.
So!utions to Chapter T+o Questions
1. ompare the merits and demerits of raster and random scanning system.
Ans.
-. In raster scan display the electron 5eam is sept across the screen one
ro at a time from top to 5ottom.
andom scan monitors dra a picture one line at a time and so they are
also referred to as vector displays.
7. efreshing on raster scan display is carried out at the rate of 34 to E4. The picture definition is stored in a memory area called refresh 5uffer or
frame 5uffer in case of a raster scan display. In case of random scan
display picture definition is stored as a set of line and some use
G!C.
-E oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
19/70
6. &$plain the principle of draing pictures on T.
Ans.
In T an electron gun produces a stream of electrons. This electron 5eam
can 5e sitched onoff through a heating system. The electron 5eam isfocused toards the phosphor coated screen. The point here the 5eam hits
the screen 5ecomes phosphorent and produces a speck of light. A pair of
focusing grids focus the 5eam to a particular point on the screen. The grid
controls the focusing ith the help of magneticelectric fields. In this ay a
hole picture can 5e dran 5y illuminating the points on the screen.
/. :xplain briefl the wor(ing principle of ;hadow mas( *9!.
Ans.!he ;hadow as( *9! is based on the principle of combining the
basic colors < red, green and blue. !he shadow mas( *9!, instead of
using one electron gun, uses three different guns placed ad=acent to
each other to form a triangle or a >+elta>. :ach pixel point on the
screen is made up of three tpes of phosphors to produce red, blue,
and green colors. ust in front of the phosphor screen, is a metal
screen, called a >shadow mas(>. !his plate has holes placed
strategicall, so that the beams from the three electron guns are
focused on particular color< producing pixel onl.
@ow, unli(e the beam penetration *9!s, the acceleration of the
electron beam was being monitored, one can manipulate the intensit
of the three beams simultaneousl. 'f the red beam is made more
intense, we get more of red color in the final combination etc. ;ince
fine
-
8/13/2019 51 Graphics and Multimedia CG
20/70
5eam from the gun. A pattern of positive charges is deposited on the grid
and this pattern is transferred to the phosphor coated T 5y a continuous
flood of electrons. This flood of electrons is mounted 5y a flood gun
hich is separate from the electron gun that produces the main electron
5eam.
. 0hat are the different graphical input interactive techni=uesD
Ans.
1olloing are the various graphical input interactive techni=ues!
a. #ositioning
5. onstraints
c. *ridsd. *ravity 1ield
e. u55er 5and methods
f. /ragging
. 0hy refreshing is re=uired in TD
Ans.
N0hen an electron 5eam strikes a dot of phosphor material it glos for afraction of a second and then fades. As 5rightness of the dots 5egins toreduce the screen image 5ecomes unsta5le and gradually fades out. In
order to maintain a sta5le image the electron 5eam must seep the entire
surface of the screen and return to redra it num5er of times per second.
That is the screen must 5e refreshedmultiple times in a second.O
@arge num5er of electron 5eam produce at high velocity on the flood gun.
The grids hich are negative changed reduce the acceleration on the lo
velocity 5ut the electrons attracted 5y the phosphor coated and display
picture 5ut they may or not a5le to produce sharp and 5right image to
overcome this pro5lem the electron 5eam seep the entire surface of the
screen and returns to redra it num5er of per second therefore it need to 5e
refreshed
#.ame the different positioning devices.
Ans.
The various positioning devices are!
74 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
21/70
,ouse Track 5all "oystick /igiti:er
Ta5lets @ight #en
". 0hat are pointing devicesD *ive e$amples.
Ans.
A pointing device is a hardare peripheral that allos user to point to
o59ects on the screen and perform operations on them such as selecting
clicking moving and dragging. ,ouse is an e$ample of pointing device.
1$. &$plain the orking principle of ,ouse.
Ans.
A mouse is a small handled 5o$ used to position the screen cursor. It has
to heels at right angles to each other. &ach of these heels is connected
to the shaft encode. 1or every incremental rotation of the heel an
electrical signal is produced 5y the shaft encode. As the device is moved on
a flat surface the movement is coded in the $ and y directions 5y counting
the num5er of pulses received from the shaft encoder. These values areheld in separate registers and the computer can sample them at a suita5le
rate. The device can therefore 5e used for a moving cursor around the
display screen.
11. &$plain the orking of @ight pen along ith a diagram.
Ans.
@ight pen has a very simple orking. &very pi$el on the screen that is apart of the picture emits light. All that the light pen does is to make use of
this light signal to indicate the position. A small aperture is held against the
portion of the picture to 5e modified and the light from the pi$els falls on a
photocell after passing through the aperture. This photocell converts the
light signal received from the screen to an electrical pulse to 5e sent as a
signal sent to the computer. Since the electrical signal is rather eak an
amplifier amplifies it 5efore 5eing sent to the computer.
A tracking softare keeps track of the position of the light pen alays.
Through the use of the tracking softare a signal received 5y the light penat any point indicates the portion of the picture that needs to 5e modified.
'IIT oordinator *uide + *raphics and ,ultimedia 7-
-
8/13/2019 51 Graphics and Multimedia CG
22/70
ote that thathen the pen is 5eing moved to its position to the position
here the modification is re=uired it itill encounter various other light
sources on the ay. These light sources should not trigger the computer to
accept the signal. So the aperture of the light pen is normally kept closed
till the final position is reached and then it can 5e opened 5y a sitch.
77 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
23/70
12. If e use > 5its for primary colors ho many different colors are
possi5leD
Ans.
E colors are possi5le.16. 8o many different choices are possi5le if e use 7C 5its per pi$elD
Ans.
-3.H million (77C) colors.
FAQ
1. Some porta5le computers have high =uality evenly colored perfectly
flat displays. Are these @/ displaysD
Ans5
These could 5e flat panel displays called *as #lasma displays hich use
neon 5ul5s.
2. 0hat is S;*D
Ans5
Scala5le ;ector *raphics (S;*)is an J,@ 5ased language for descri5ing7/ vector graphics. It is 5eing vieed as the standard for descri5ing vector
graphics on the e5 in the future. 8oever currently many 5rosers do
not support it.
6. Should the resolution of an image 5e changed as per the monitor
resolutionD
Ans5
0hen you create images you can set their resolution. The resolution of an
image should ideally 5e 5eteen H7 and 23 ppi. 8oever the e$act value
should 5e decided 5ased on the monitor resolution. 1or e$ample for a -C
inches monitor ith E44 J 344 resolution an image resolution of H3
-
8/13/2019 51 Graphics and Multimedia CG
24/70
Ans5
The most appropriate refresh rate is considered to 5e H7 and EG 8:. hapter Three
Objectives
In this chapter the students have learned to! reate graphics using functions
reate animation using functions
Focus Areas
Introduce as one of the oldest 5ut strongest programming languages. Tell
the students that also supports graphics and animation. Although creating
an animation using a modern animation package such as Imageready is
much easier than riting hundreds of lines of code in forms thefoundation of such graphics packages. In fact students can create a
graphics package such as ,S #aint themselves using Fs support for
graphics and knoledge of some additional concepts such as handling the
mouse input.
e$t mention the to modes through hich graphics and te$t can 5e
displayed in language.
Tell the students that the actual graphics and animation is done in the
graphics mode. 6ou can e$plain the 5asics of the graphics mode referringto the topic reating *raphics in from the Additional Inputs
sectionInputs section.
&$plain the various graphics functions availa5le in using e$amples.
Take the e$ample of creating a hut. Start 5y creating a hut simply using the
line draing related functions. e$t e$plain ho to create the same hut
using rectangle() 5ar() arc() and other such shape related functions. o
e$plain the concept of filling images using solid fills or patterns. Again
use the e$ample of the hut to demonstrate the related functions. 1or
practice1or practiceyou could discuss ith the class the creation of theIndian flag or a human face. These e$amples have 5een e$plained at the
5ack of the 5ook.
1inally e$plain animation support in .
Aitiona! Inputs
The folloing section provides some e$tra inputs on the important topics
covered in the S*!
Creatin& %raphics in C
7C oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
25/70
To rite a program for creating graphics you must follo the folloing
procedure!
-. Include the graphics.h file in your program.
7. Sitch over to the graphics mode hich offers the 5est resolutions
using the initgraph() function. This function initiali:es the graphicsmode. Its synta$ is!
initgraph(int Pdriver int Pmode char Ppath)Q
>. As its parameters you must specify the graphics mode such as &*A or
;*A (depends on the graphics adapter 5eing used) the graphics driver
(a program that interfaces 5eteen the hardare and your program)
and path of the graphics driver. To specify the value of the graphics
driver parameter refer to the folloing ta5le!
Value/Constants
4 or /&T&T
- or *A
7 or ,*A
> or &*A
C or &*A3C
G or &*A,??
3 or IB,EG-C
H or 8&,??
E or ATTC44
2 or ;*A
-4 or #>7H4
ote that during e$ecution ith a call to initgraph() your system
sitches to the graphics mode and the mouse cursor disappears.
C. all appropriate functions to create graphics.
G. lose the graphics mode using the closegraph() function hen you
have ritten the code for creating graphics.
'IIT oordinator *uide + *raphics and ,ultimedia 7G
-
8/13/2019 51 Graphics and Multimedia CG
26/70
3. all the restorecrtmode() to restore the original video mode of your
monitor.
)ra+in& Shapes in C
6ou have learned a5out various shape creation functions in the te$t5ooksuch as arc() and 5ar(). If you ant to create a rectangle or s=uare
5oundary ithout any color inside it you can use the rectangle() function.
The synta$ of this function is!
rectangle(int left int top int right int 5ottom)Q
To dra a rectangle you must specify the coordinates of its top left and
5ottom right corner points as the four parameters of the rectangle()
function. This function creates a rectangle in the specific line style
thickness and color hich have 5een set prior to a call made to thisfunction. If these ere not set the defaults are used.
ote that the 5ar() and rectangle() functions are different. The 5ar()
function creates a rectangular shape ithout 5oundary and fills it in the
current fill pattern and color. ?n the other hand rectangle() creates a
rectangular 5oundary in the current color and pattern.
0hile draing shapes in programs it is important to understand the
screen coordinate system and the meaning of the parameters that specify
the coordinate points of these shapes.
0hen you sitch to the graphics mode the hole screen 5ecomes a virtual
coordinate system according to hich the coordinates specified in the
graphics function in your programs are determined. &ach pi$el represents a
point in this coordinate system. It is important to identify the position
here you ant to dra your shapes.
73 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
27/70
As an e$ample consider the folloing screen coordinate system in the 3C4
J CE4 mode!
Error Chec.in& Routine
It is a good practice to check for errors hen initiating the graphics mode.
6ou can do this using the graphresult() function.The graphresult() function returns an integer representing the values given
in the folloing ta5le!
Value Constant Associated error message, a string
which can be returned by the
graherrormsg!"
grO% &o error
'1 gr&o(nit)raph *+)( graphics not installed *useinitgraph
'# gr&ot-etected )raphics hardware not detected
'. grFile&otFound -evice driver file not found
'4 gr(nvalid-river (nvalid device driver file
'" gr&o/oad0em &ot enough memory to load driver
'6 gr&oScan0em Out of memory in scan fill
'IIT oordinator *uide + *raphics and ,ultimedia 7H
-
8/13/2019 51 Graphics and Multimedia CG
28/70
Value Constant Associated error message, a string
which can be returned by the
graherrormsg!"
'$ gr&oFlood0em Out of memory in flood fill
'8 grFont&otFound Font file not found
'9 gr&oFont0em &ot enough memory to load font
'1 gr(nvalid0ode (nvalid graphics mode for selected
driver
'11 grrror )raphics error
'1# gr(Oerror )raphics (2O error
'1. )r(nvalidFont (nvalid font file
'14 )r(nvalidFont&um (nvalid font num3er
'1" gr(nvalid-evice&u
m
(nvalid device num3er
'18 )r(nvalidersion (nvalid version num3er
6ou can use the graphresult() function to catch errors as follos!
P initiali:e graphics mode P
initgraph(%gdriver %gmode d!RRtcRR5gi)Q
P read result of initiali:ation P
errorcode graphresult()Q
if (errorcode gr?k) P an error
occurred P
printf(*raphics error. Rn)Q
grapherrormsg(errorcode)Q
printf(#ress any key to halt!)Q
getch()Q
e$it(-)Q P return ith error code P
V
Ani$atin&
7E oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
29/70
In the 5ook a step is missing for implementing animation.
0hen you call imagesi:e() it returns the area of the rectangle 5ounding the
image. Before calling getimage() you must allocate enough memory so
that the image can 5e handled 5y getimage() as!
int area imagesi:e(7G>4HGHG)Q
unsigned char P 5uf malloc(arear)Q
getimage(7G>4HGHG 5uf)Q
The malloc() function allocates as many 5ytes as specified in its parameter.
'IIT oordinator *uide + *raphics and ,ultimedia 72
-
8/13/2019 51 Graphics and Multimedia CG
30/70
So!utions to Chapter Three Questions
1. ompare the features of te$t and graphics modeD
Ans.
The folloing ta5le compares the te$t and graphics modes!
#e$t mode %rahics mode
5ou can only handle tet7 5ou can display, capture,
and animate figures7
5ou can display in 16
colors on a color
monitor7
5ou can display various
colors7
et mode display is in
two forms, #" rows of 4
columns or #" rows of 8
columns7
he resolution of the
graphics mode depends on
the adapter7
2. 0ith the help of an illustration e$plain ho initgraph() function orks.
Ans.
The initgraph() function is used to initiali:e the graphics system to load
appropriate graphics drive and video mode used 5y the graphics functions.
The synta$ of this function is!
initgraph(int Pdriver int Pmode char Ppath)
As its parameters you must specify the graphics mode such as &*A or
;*A (depends on the graphics adapter 5eing used) the graphics driver (a
program that interfaced 5eteen the hardare and your program) and
path of the graphics driver.1or e$ample to initiali:e graphics mode in *A high resolution mode!
int gdriver - gmodeCQ
initgraph(%gdriver %gmode d!RRtcRR5gi)Q
1or e$ample to select the 5est driver and mode possi5le on a computer!
int gdriver /&T&T gmodeQ
initgraph(%gdriver %gmode d!RRtcRR5gi)Q
>4 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
31/70
6. Use graphics function to dra concentric circlesD
Ans.
WincludeXconio.hY
WincludeXgraphics.hYW includeXstdio.hY
main()
int gdriver /&T&T gmodeQ
P initiali:e graphics mode P
initgraph(%gdriver %gmode d!RRtcRR5gi)Q
circle(-44-4424)Q
circle(-44-44G4)Q
circle(-44-44>4)Q
getch()Q
restorecrtmode()Q
V
Inform the students that the pathZd!RRtcRR5gi[ should 5e changed according
to the machine settings. The code given here has 5een tested on Tur5o
>.4.
/. /evelop a program to dra a structure of a fish and give animation.
Ans.
WincludeXgraphics.hY
WincludeXstdio.hY
WincludeXstdli5.hY
WincludeXconio.hY
WincludeXdos.hY
void main()
int gdriver/&T&TgmodeQ
int iQ
initgraph(%gdriver%gmodee!RRtcRR5gi)Q
int ma$\ygetma$y()7Q
i4Q
'IIT oordinator *uide + *raphics and ,ultimedia >-
-
8/13/2019 51 Graphics and Multimedia CG
32/70
setcolor(B@U&)Q
hile(k5hit())
line(4ima$\y>44ima$\y4)Q PtriangleP
line(4ima$\y>4>4ima$\y)Qline(4ima$\y4>4ima$\y)Q
ellipse(24ima$\y4>3434>G)Q
circle(-74ima$\yQ
if(iY3>G)
i4Q
delay(-44)Q
cleardevice()Q
V
getch()Q
closegraph()Q
V
Inform the students that the pathZe!RRtcRR5gi[ should 5e changed according
to the machine settings. The code given here has 5een tested on Tur5o >.4.
>7 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
33/70
0. /evelop a program to dra a car shape and move the car using
animation functions.
Ans.
WincludeXgraphics.hYWincludeXconio.hY
WincludeXdos.hY
WincludeXstdli5.hY
void car\heel(int $int y)
setcolor(08IT&)Q
setfillstyle(S?@I/\1I@@08IT&)Q
circle($y-4)Q
floodfill($y08IT&)Q
circle($y7G)Q
V
void car\5ody()
car\heel(G4744)Q
car\heel(744744)Q
setcolor(&/)Q
line(7G74447-4)Q
line(C4-34H4->4)Q
5ar(-4G--4-7G->4)Q
line(4-34C4-34)Q
line(H4->4-H4->4)Q
line(-H4->4744-34)Qline(-HG744HG744)Q
line(744-34734-34)Q
line(734-34734744)Q
line(73474477G744)Q
arc(G47444-E47G)Q
arc(7447444-E47G)Q
setfillstyle(S?@I/\1I@@&/)Q
'IIT oordinator *uide + *raphics and ,ultimedia >>
-
8/13/2019 51 Graphics and Multimedia CG
34/70
floodfill(-G4-H4&/)Q
V
void main()
int gdriver /&T&TgmodeQint iQ
void P5uffQ
initgraph(%gdriver%gmodee!RRtcRR5gi )Q
car\5ody()Q
5uffmalloc(imagesi:e(4-447H47>4))Q
getimage(4-447H47>45uff)Q
putimage(4-445uffJ?\#UT)Q
i4Q
hile(k5hit())
if(iYG44) i4Q
putimage(i-445uff?\#UT)Q
delay(HG)Q
putimage(i-445uffJ?\#UT)Q
putimage(iG-445uff?\#UT)Q
delay(HG)Q
putimage(iG-445uffJ?\#UT)Q
i i-4
V
closegraph()Q
restorecrtmode()Qgetch()Q
V
Inform the students that the pathZd!RRtcRR5gi[ should 5e changed according
to the machine settings. The code given here has 5een tested on Tur5o
>.4.
. @ist the different graphics functions along ith e$ample.
Ans.
>C oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
35/70
supports various graphics functions such as!
line(int $- int y- int $7 int y7)! This dras a line from position ($-
y-) to ($7 y7)
&$ample! line(-4G4-4-44)Q
5ar(int $- int y- int $7 int y7)! This dras a filled rectangle ithdiagonal from ($- y-) to ($7y7)
5ar(-47G-44HG) circle(int $ int y int r)! This dras a circle ith center at ($ y) and
radius of r.
&$ample! circle(G4G4-4) arc(int $ int y int start int end int r)! This dras an arc of circle ith
the center at ($y) radius r and start and end specified in degrees to
mention the portion of the circle that forms the arc.
&$ample! arc(-44-4442474) dras the first =uarter of the circle arcith center (-44-44) and radius 74.
. 0hat is the use of malloc() function in .
Ans.
The malloc() function allocates memory for an o59ect. The num5er of 5ytes
of memory to 5e allocated is specified as its parameter.
#. &$plain the use of getimage() and putimage() ith e$amplesDAns.
The getimage() function captures the image inside the rectangle hose
diagonal is defined 5y ($- y-) and ($7y7)here $- y- $7 and y7 are
the first four parameters of getimage(). The captured image is stored in an
array hich is specified as the last parameter of getimage().
1or e$ample to capture a rectangle hose diagonal is defined 5y (-4 G4)
and (G4 -7G) you can use the getimage() function as!
int area imagesi:e(-4G4G4-7G)Qunsigned char P 5uf malloc(arear)Q
getimage(-4G4G4-7G 5uf)Q
The putimage() function copies the image captured using getimage()
starting at location ($ y) here $ and y are the first to parameters of this
function. The image to 5e captured is specified as the third parameter. The
fourth parameter of this function specifies ho the image has to 5e copied
and takes any of the folloing values!
?#6\#UT or 4 hich copies the image as it is
'IIT oordinator *uide + *raphics and ,ultimedia >G
-
8/13/2019 51 Graphics and Multimedia CG
36/70
J?\#UT or - hich performs an e$clusive ? 5eteen the
5ackground pi$els and the image pi$els ?\#UT or 7 hich performs an inclusive ? 5eteen the
5ackground pi$els and the image pi$els
A/\#UT or > hich performs an A/ 5eteen the 5ackgroundpi$els and the image pi$els
?T\#UT or C hich inverts the pi$els of the image.
1or e$ample animate a rectangle as it is you can use the ?#6\#UT
option in putimage!
putimage(-4G4 5uf ?#6\#UT)Q
FAQ
1. 0hat are the various fill patterns in D
Ans5
The various fill patterns include!
&attern Constant Value 'escrition
05:F(// +ac%ground color fill
SO/(-:F(// 1 Solid fill
/(&:F(// # '''''''
/S/;S
-
8/13/2019 51 Graphics and Multimedia CG
37/70
&attern Constant Value 'escrition
BS@:F(// 1# Bser'defined fill
pattern
2. 8o can you create user> 4$7E4$AB4$-44$-H4$11VQ6ou use setfillstyle() for predefined patterns. 1or user
-
8/13/2019 51 Graphics and Multimedia CG
38/70
/. 8o can you make an o59ect animate infinitely till you press the &nter
key to e$itD
Ans5
6ou can make an o59ect animate till you hit a key using the k5hit()
function. 0hen this function is called it returns true if an input character is
availa5le in the read 5uffer for reading. If there is nothing to 5e read it
returns false. 6ou can use this function as!
int continue -Q
hile(continue)
if(k5hit())
ch getch()Q
if(ch 7H)
5reakQ
V
else
animation code
V
V
0. It is easy to dra lines or plot points in relation to the screen coordinate
system. 8o can you move the cursor 5y a position relative to another
point on the screenD
Ans5
6ou can do this using the moverel(int $ int y) function. It moves the cursor
$ pi$els in the J direction and y pi$els in 6 direction from the current
position. ote that it does not dra any line hile doing so. To dra a line
from a point to a relative point use the linerel(int $ int y) function.
>E oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
39/70
Chapter Four
Objectives
In this chapter the students have learned to!
/escri5e the origin and development of multimedia
Identify the components of multimedia
@ist the digital imaging technologies
/escri5e video as a component of multimedia
/escri5e audio as a component of multimedia
Identify types of animation
/escri5e >/ animation techni=ues
Apply digital filtering and special effects
@ist latest multimedia technologies tools and accessories
Focus Areas
Introduce multimedia 5y asking students the various reasons hy they
ould use a computer. ommon ansers ould 5e listening to music
atching video and surfing e5sites hich are rich in graphics te$t
audio and video. Tell the students that these are the components that are
collectively knon as multimedia. At this stage list each of the components
of multimedia including te$t graphics sound video and animation.
&$plain the difference 5eteen a normal desktop # and a multimedia
system. /iscuss the origin and development of multimedia 5riefly.
Introduce some of the multimedia packages and products 5eing used in the
field of multimedia noadays.
e$t e$plain digital imaging. 6ou may e$plain this concept ith reference
to the additional inputs given in the Additional Inputs sectionInputs
section.
/iscuss video and audio as multimedia components. #rompt students to
identify common formats for these components as ell as tools used forcreating editing and using these components.
To other important topics in this chapter are Animation and /igital
1iltering and Special &ffects. /iscuss these topics in an interactive manner
ith the students. 6ou could link the latter topic to #hotoshop hich is
discussed in the ne$t chapter and create conte$t for it.
Aitiona! Inputs
'IIT oordinator *uide + *raphics and ,ultimedia >2
-
8/13/2019 51 Graphics and Multimedia CG
40/70
The folloing section provides some e$tra inputs on the important topics
covered in the S*!
Sa$p!in& Rate o# Auio
An important characteristic of audio hen it is digiti:ed is the samplingrate. Sound is in the form of analog signals. 0hen these analog signals are
digiti:ed for use on computers the sound aveforms is measured or
sampled at specific intervals. The num5er of samples taken per second is
the sampling rate. Informally you could compare a sample to a frame in an
animation or video. The more the num5er of frames the smoother is the
animation or video. Similarly the higher the sampling rate the 5etter is the
=uality of digiti:ed sound. A high sampling rate ould therefore mean that
the sound as digiti:ed from its analog aveform more precisely.
,athematically sampling rate is e$pressed in 8: as tice the highestfre=uency of sound in the analog aveform.
C4 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
41/70
I$portant Scanner Characteristics #or )i&ita!I$a&in&
The resolution (dpi) of a scanner is a crucial characteristic to 5e considered
during digital imaging. Apart from resolution other importantcharacteristics to 5e considered during digital imaging are!
4it depth! Bit depth is the num5er of 5its per pi$el. Bits contain color
information. Therefore the num5er of 5its defining a pi$el in an image
affects the =uality of the FrealismF of the digital image as compared to
the original image. This is actually 5ecause the tones in an image
depend on 5it depth. An image ith 5it depth of - ill 5e a5le to
represent 7- 7 tones (5lack and hite). An image ith more 5it depth
can represent more num5er of tones. 1or e$ample images ith 5it
depth 7C can represent over -3 million tones. 0ith the popularity ofdigital imaging modern scanners are supporting higher 5it depths. 1or
e$ample most good 8# scanners no support CE
-
8/13/2019 51 Graphics and Multimedia CG
42/70
Bit depth esolution
A simple formula for estimating the si:e of a file in hich an o59ect ill 5e
scanned can 5e calculated from the folloing formula!
1ile si:e (#i$el esolution $ Bit depth $ esolution)E 5ytes
1or e$ample if a 7C44 dpi its file si:e
ould 5e!
1ile si:e (>444 $ >>44 $ 7C $ >44) E E2-4444444 5ytes.
C7 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
43/70
Popu!ar Auio For$ats
The four most popular audio file formats include!
(ormat 'escrition
0(-( 0usical (nstrument -igital (nterface or 0(-(
was developed in 198#7 (t stores digital music
instructions instead of actual sound data7 (t
can play only music as it records notes not
sounds7
he siCe of a 0(-( file is very small and its
etension is 7mid or 7midi
ypically the file siCe of a 7midi file is #" =+for " minutes audio7
A; Format A; Format was developed 3y (+0 and
0icrosoft7 (t is AindowsD inherent file format
for storing audio7 For eample, sounds that
are played when you perform an action in
Aindows such as logging on to Aindows are
all in 7wav format7 (t stores uncompressed
?- Euality audio however the file siCe ofa 7wav file is very large7 ypically the file siCe
if a 7wav file is 1 0+ for a minuteGs audio7
@eal ;udio Specifically developed with the (nternet as the
target, its main advantage is streaming audio7
7ra files can only 3e played with a @eal One
player 3ecause it is a proprietary format7
0. 0) /ayer . or 0. is a highly
compressed 3ut good Euality sound fileformat, which has revolutioniCed digital
music sharing and storing7 0. files have the
etension 7mp. and 7mpga7
ypically a " minutes audio is stored 3etween
47" to "7" 0+7
Apart from the a5ove formats other knon formats include AU format
(.au) AI11 format (.aif or.aiff) S/ format (.snd) 0indos ,edia Audioformat (.ma) flac format (.flac) and ogg format (.ogg).
'IIT oordinator *uide + *raphics and ,ultimedia C>
-
8/13/2019 51 Graphics and Multimedia CG
44/70
Popu!ar ,ieo For$ats
The most popular video formats include!
(ormat 'escrition
0) (t is one of the most popular formats, which
can 3e played on computers as well as most
?-2-- players7 he Euality is the same as
that of ?@s7
0) actually encompasses versions,
0)1, 0)#, and 0)47
;( *7avi Bsed on the Aindows platform7 he Euality of
these files is not good, considering their siCe7
Huic%ime
*7mov
?ommonly used on 0acintosh systems7 (t is
also compati3le with the Aindows platform7 (ts
Euality is good, considering the siCe of the files7
his format also provides streaming video7
@ealideo*7rm Bsed for streaming video7 he Euality is
considered to 3e decent7
Some other video formats include /ivJ AS# Intel ;ideo Technology
(I;1) and 0,;.
Scannin& I$a&es #or 0eb Use
0hen you scan an image or create one save it at H7 dpi for use on the
Internet. Anything more than H7
-
8/13/2019 51 Graphics and Multimedia CG
45/70
2. 0hat are the main components of ,ultimediaD
Ans.
The components of ,ultimedia are as follos! Te$t *raphics Sound Animation ;ideo
6. With illustration briefl narrate the origin and development of
multimedia technolog?Ans.
ultimedia is an effective medium to express information in a more
attractive wa. 't ma(es use of text, pictures, audio, animation, and
video. 't was started more then 20 ears ago. 7owever, it onl became
popular with the advent of des(top computers.
Audio was the first multimedia data incorporated into des(top
computing, with the introduction of soundboards built around the
tone
-
8/13/2019 51 Graphics and Multimedia CG
46/70
!he latest brea(through in the field of multimedia was the advent of
the 'nternet and other high
-
8/13/2019 51 Graphics and Multimedia CG
47/70
. What are the different choices for digital imaging?
Ans.
!here are three different choices for digital imaging5 A film less camera ma capture an image electronicall
!he image ma be created within the computer using various paints
and illustration programs
!he image ma be created traditionall and than scanned into
digital form
#. What are the different (inds of film less cameras available in the
mar(et?Ans.
!here are five different tpes of film less cameras suitable for digital
imaging available in the mar(et5
8ideo flopp dis( *ameras
+igital *ameras
)**'A *ameras
%ilmless *amera bac(s
;till 8ideo *ameras
". &$plain ho an artist can make use of multimedia softare for his ork.
Ans.
An artist can create illustrations using illustration softare such as Ado5e
Illustrator. 8e can also apply special effects to e$isting and ne images
through filters such as those in #hotoshop and Illustrator. In addition he
can scan hand
-
8/13/2019 51 Graphics and Multimedia CG
48/70
1$. &$plain ho moving images are recorded on the hard disk.
Ans.
,oving images can 5e captured or copied on the hard disk ith the help of
a capture 5oard./igital cameras 1 or audio and video ports are connected to the
corresponding 1 of Audio video ports availa5le in the capture 5oard.
0ith the help of any ;ideo studio softare live images can 5e captured
and stored on the hard disk.
11. &$plain ho sound helps in multimedia. 0hat are the ma9or types of
sound filesD
Ans.
Sound in multimedia can include speech special effect sounds and music.
Sound is an essential component of a multimedia production such as video
or animation and presentations. It helps to make a multimedia application
entertaining easy to understand and more presenta5le. 1or e$ample a
presentation used for computer
-
8/13/2019 51 Graphics and Multimedia CG
49/70
1/. :xplain the meaning of the following terms5 orphing, 9endering,
Wrapping.
Ans.
orphing5 't is the process of transformation of one image to
another b the transformation and distortion of corresponding
points in both the images. !he best example will be Dawasa(i
advertisement where the motorbi(e changes into a cheetah.
9endering5 !he process of converting our designed ob=ects with
texturing and animation into an image or a series of images is called
rendering.
Wrapping5 't is the process where certain parts of the image could
be mar(ed for a change and made to change to different one forexample legs of cheetah to be morphed with the wheels and head
with head lights. 7ead can alone be mar(ed and wrapped.
10. 0hat is the meaning of file formatD
Ans.
The method 5y hich softare organi:es the data in the saved file is called
the file format. The file name e$tension or suffi$es indicate the format or
usage of the file. Several different types of file formats are used 5y variouskinds of softare. 1or e$ample! the *I1 file format used for 0e5 page
images is a standard format that can 5e opened 5y any program that
supports that standard format.
'IIT oordinator *uide + *raphics and ,ultimedia C2
-
8/13/2019 51 Graphics and Multimedia CG
50/70
1. Wh do we use a scanner? @ame the different tpes of scanners?
Ans.
;canner is a peripheral device, which captures real ob=ect or image
and saves it in a digital file as a graphic. +ifferent tpes of scanner areas follows5
%latbed or ;heet
-
8/13/2019 51 Graphics and Multimedia CG
51/70
%ile extensions help a user as well as an application to identif the file
format. %or example, ou can identif a graphic file b its extension
such as .gif or .=pg. ;imilarl when ou double clic( on a .gif file,
Windows would read the extension and select the appropriate
program for opening the file.%ill in the 4lan(s
-. ultimediaconstitutes an integration of multiple media such as te$t
graphics audio video and animation elements.
7. "#&* uses losscompression techni=ues.
>. Wave or .wav files are ,icrosoft standard file format for storing
aveform audio data.
C. The amount of data that can 5e transmitted from one computer to
another in a given time frame is called bit rate.
G. The process of removal of e$traneous noise that inevita5le creeps into arecording is called filtering.
'IIT oordinator *uide + *raphics and ,ultimedia G-
-
8/13/2019 51 Graphics and Multimedia CG
52/70
FAQ
1. 0hat is a deci5elD
Ans5
/eci5el is a relative measure of the loudnessintensity of sound. It is
actually measured as a ratio. A sound of 4dB is hardly audi5le to the
human ear. 8earing a sound a5ove E4
-
8/13/2019 51 Graphics and Multimedia CG
53/70
and ,ultimedia #roperties dialog 5o$ opens. avigate to the 8ardare ta5
and select Audio odecs in the list. e$t click the #roperties 5utton a
dialog 5o$ shoing the codecs installed ill open.
'IIT oordinator *uide + *raphics and ,ultimedia G>
-
8/13/2019 51 Graphics and Multimedia CG
54/70
Chapter Five
Objectives
In this chapter the students have learned to!
&dit 5itmap and vector graphics
hange color modes
ompare different file formats
Use #hotoshop tools and features!
ectangle ,ar=uee tool
@asso tool
#ainting tools
&diting tools
olor selection and cropping tools
Selection tools
#rinting features
*raphics file formats supported
Use the layers palette
Focus Areas
Introduce #hotoshop as one of the most popular image editing and graphics
creation tool hich is an Ado5e product. Inform the students that#hotoshopFs first version -.4 as shipped in -224. Since then various
versions have 5een launched. ;ersion 3.4 included various ne features
hich made #hotoshop very popular. The latest version of #hotoshop is
#hotoshop S hich includes revolutionary features in the field of image
editing. Ask the students to refer to the official Ado5e site to get an
overvie of the ne features of #hotoshop S.
#rovide the students a 5rief list of the various tools supported 5y #hotoshop
and kind of image editing and graphic creation that can 5e done using these
tools. &mphasi:e the advantages of #hotoshop in various fields such asprinting and media.
Tell them that 7/ morphing is also possi5le in #hotoshop here they can
actually merge the 5ody of one person ith the face of another.
Aitiona! Inputs
The folloing section provides some e$tra inputs on the important topics
covered in the S*!
Photoshop Shortcuts
GC oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
55/70
Ta5le G.- 5elo lists key5oard shortcuts of some commonly used
operations in #hotoshop!
Short cuts #ools
1- #hotoshop 8elp
1G Brush #alette
13 olor #alette
1H @ayer #alette
1E avigator Info
12 8istory Actions Tool#resets
Shift Alt opy same layer
trl ulers
]oom In trl
]oom In trl
-
8/13/2019 51 Graphics and Multimedia CG
56/70
Short cuts #ools
BlurSharpenSmudge
Tool
Type Tool T
#en Tool #
&raser Tool &
rop Tool
,ultiple 8istory (Step
Backards)
trl Alt ]
/irect selection trl Any Arro
/ecrease 5rush si:e N
Increase 5rush si:e O
#revious 5rush X
e$t 5rush Y
1ree Transform trl T
G3 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
57/70
Pen Too! in Photoshop ,ersion 1
An important graphics creation and tracing tool in #hotoshop is the #en
tool. #en tool ena5les creation of vector illustration through lines and
curves. Using the #en tool you can create your on illustrations. Unlike a#encil tool a #en tool does not merely create an outlineQ it creates the
outline of an illustration as a path hich can 5e edited during creation or
even after creation.
#erform the folloing steps to create a face of a person using the #en tool!
-. ?pen a ne image in #hotoshop.
7. lick the #en tool icon in the tool5o$. o place the mouse cursor in
the image area.
>. lick at any point in the 5lank canvas from here you ant to startcreating the illustration. A point ill appear on the canvas. This point is
called an anchor point or a node.
C. lick at another location in the canvas to connect the anchor point
created in Step > to the ne point. A line ill 5e created 5eteen the
to anchor points as shon in the folloing figure!
ote that the point hich is filled ith solid color is the one hichas created in this step and is currently selected.
'IIT oordinator *uide + *raphics and ,ultimedia GH
-
8/13/2019 51 Graphics and Multimedia CG
58/70
G. Similarly you can keep clicking to connect points in the shape of a
face. ote that the closer you click to create anchor points the more
curved ill the path 5e. The folloing figure shos the outline of the
face after the last anchor point has 5een connected to the first anchor
point to form a closed path!
0hen you are at the first and the last anchor points the mouse cursor
(representing the pen tool) ill appear ith a small circle 5elo it to
indicate that the path ill 5e closed if the points are connected. ?nce apath is closed you can only edit it you cannot e$tend it.
3. To fill color in the illustration created using #en tool you must convert
the path to a selection 5y performing the folloing steps!
a. ?pen the #aths palate 5y selecting WindowE;how )aths.
5. lick the Y sign on the right side of the #aths palate and select
a(e ;election...from the menu. lick ?K in the ,ake Selection
dialog 5o$ that appears. The 0orkpath ill 5e converted to a
selection.
c. 1ill color in the selection using the #aint Bucket tool as shon in thefolloing figure!
GE oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
59/70
ote that you can convert a selection 5ack to a path in the same ay
5y selecting a(e Wor( )ath...in the #aths palate.
The procedure e$plained a5ove is only one of the ays and not a versatile
ay of using the #en tool. 6ou can use the #en tool to create curves 5y
dragging hile you click to create an anchor point. 6ou can also edit
individual anchor points.
To dra a curve using the #en tool click to create the starting anchor
point. e$t click and drag to create the ne$t anchor point. A curve ill 5e
created as shon in the folloing figure!
otice the to e$tended lines e emanating out of the selected anchor
point in the a5ove figure. These are called the handles of the anchor point.
6ou can move the handles simultaneously or individually using the
onvert Anchor #oint tool (availa5le in the #en tool options if you right
'IIT oordinator *uide + *raphics and ,ultimedia G2
-
8/13/2019 51 Graphics and Multimedia CG
60/70
click on it). By dragging the handles you change the orientation of the
curve as desired.
Apart from the onvert Anchor #oint tool under the #en tool to other
useful options are Add Anchor #oint Tool and /elete Anchor #oint Tool.
6ou can select the Add Anchor point tool to add an anchor point at anylocation in a path. 6ou can then use the handles of this anchor point to
modify the shape of the path at that point. Similarly you can delete an
anchor point in a path using the /elete Anchor #oint tool. These to tools
along ith the onvert Anchor #oint tool can 5e used to impart a smooth
shape to an illustration.
Creatin& Custo$ Fi!ters in Photoshop
Apart from the filter effects availa5le in #hotoshopFs 1ilter menu you can
also create your on custom filter for applying on images. Using a customfilter you can change the 5rightness value of each pi$el in the image
according to a predefined mathematical operation knon as convolution.
onvolution is an integral 5ased mathematical operation 5eteen to
functions hich is often said to F5lendF the functions.
As a result of the application of convolution each pi$el in an image on
hich a custom filter is applied is reassigned a value 5ased on the values of
surrounding pi$els.
To create a custom filter perform the folloing steps!-. ?pen the image to hich you ant to apply the filter.
34 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
61/70
7. Select %ilter E Cther E *ustom from the main menu of #hotoshop.
The ustom dialog 5o$ opens as shon here!
The ustom dialog 5o$ shos the previe of the image in the right
hand side 5o$ if the #revie check5o$ on the left side is selected.
>. lick in any unla5eled te$t 5o$ hich represents the pi$el 5eing
evaluated. &nter the value 5y hich you ant to multiply that pi$elFs
5rightness value. This value can 5e 5eteen
-
8/13/2019 51 Graphics and Multimedia CG
62/70
#hotoshop in general allos users to customi:e the graphical user interface
according to their convenience 5y shoinghiding and placing the palates
tool5o$ and rulers. 8oever a remarka5le feature in #hotoshop S is the
a5ility to save the #hotoshop orking environment as a 0orkspace. That
is the ay you place palates and the tool5o$ ho you separate groupedpalates can 5e saved even after you close #hotoshop so that the ne$t time
you open it the *UI appears the same as you had left it 5efore closing.
This 0orkspace features are availa5le under the WindowEWor(space.
37 oordinator *uide + *raphics and ,ultimedia 'IIT
-
8/13/2019 51 Graphics and Multimedia CG
63/70
So!utions to Chapter Five Questions
1. 1ill in the 5lanks!
a. omputer *raphics can 5e classified into \\\\\\\\\\\\\ and\\\\\\\\\\\\\\\.
Ans.
Bitmap
Images
b. A #hotoshop file can contain vector % raster data.
Ans.
True
c.\\\\\\\\\\ is defined as the num5er of pi$el along the height % idth
of 5itmap.
Ans.
esolution
d.\\\\\\\\\\\\\ ,ethod is used to assign color values to any ne pi$el
at the time of re
-
8/13/2019 51 Graphics and Multimedia CG
64/70
6. 0hat is gamut in #hotoshopD
Ans.
The series of colors that a color system can demonstrate or print is called
gamut in #hotoshop. A color that can 5e displayed in *B may 5e out of
gamut and therefore unprinta5le for your ,6K setting.
/. 0hat is a layerD
Ans.
@ayers can 5e visuali:ed as transparent sheets placed over one another in
an image. reating a layered image refers to putting different o59ects on
different levels in a se=uence. . 6ou can create empty layers and add
content to them or you can create ne layers from e$isting content. 0henyou create a ne layer it appears either a5ove the selected layer or ithin
the selected layer set in the @ayers palette.
@ayer sets help you organi:e and manage layers. 6ou can use layer sets to
easily move layers as a group to apply attri5utes and masks to groups of
layers and to reduce clutter in the @ayers palette. 6ou cannot create a ne
layer set ithin an e$isting layer set.
0.ame the different selections tools.Ans.
The selection tools in #hotoshop include the @asso tool #en tools
,ar=uee Tool and #ath selection tool.
. What are editing !ools?
Ans.
:diting tools are used to fine
-
8/13/2019 51 Graphics and Multimedia CG
65/70
1. Cpen the image that ou want to clone.
2. ;elect rubber stamp tool.
6. ;elect an appropriate brush size and stle from the 4rush drop
down in the options bar at the top. Also set values for other options
such as blending mode, opacit, and flow. +etermine how ou wantto align the sampled pixels. 'f ou select Aligned, ou can release
the mouse button without losing the current sampling point. As a
result, the sampled pixels are applied continuousl, no matter how
man times ou stop and resume painting. 'f ou deselect Aligned,
the sampled pixels are applied from the initial sampling point each
time ou stop and resume painting. ;elect se All Faers to sample
data from all visible laersH deselect se All Faers to sample onl
from the active laer.
/. )ress Alt and clic( the image that ou want to clone, to select thesource point for cloning.
0. se the brush to clone the image b dragging the mouse on another
area. !he image will be cloned in that area.
#. What is %ile %ormat? @ame the different image file formats?
Ans.
!he method b which the software organizes the data in the saved file
is called the file format. !he file name extension or suffixes indicate theformat or usage of a file and a brief description of that format. ;everal
different tpes of file format are used b various (ind of software to
save files. %or example, the G'% file format used for Web page images
are standard formats that can be opened b an program that
supports it.
!he various image file format are as follows5
!agged
-
8/13/2019 51 Graphics and Multimedia CG
66/70
". *ive the steps to use the image printing utility of #hotoshopD
Ans.
In #hotoshop you can print a complete image selected area of an image
or even one or more layers.To print a complete image select 1ile
-
8/13/2019 51 Graphics and Multimedia CG
67/70
6ou can also choose to print the filename along ith crop marks
registration marks and a caption along ith the image. To set such options
select 1ile Y#age Setup in #hotoshop 3. The #age Setup dialog 5o$ opens
as shon in the folloing figure!
6ou can select the check5o$es if you ant to include the corresponding
options in the printed image!
*aption! Selecting this check5o$ ill print a caption ith the image.
This caption can 5e set in the 1ile Info dialog 5o$. To open the 1ile Info
dialog 5o$ select 1ile Y 1ile Info and choose aption from the Section
drop
-
8/13/2019 51 Graphics and Multimedia CG
68/70
*enter *rop ar(s! Select this check5o$ to vie the e$act center of
the image defined 5y to crossed lines. Fabels! Select this check5o$ to print the file name ne$t to the image.
6ou can also print the name of the appropriate color channel if you are
using color separations. @egative! Select this check5o$ to print an image that appears like a
negative of the original image. 0ith this option selected the colors are
reversed.
:mulsion +own! Select this check5o$ to print the image as a hori:ontal
mirror image of the original image.
'nterpolation! Interpolation refers to a printerFs a5ility to resample an
image as they print it to improve its resolution. This option is useful in
case of lo
-
8/13/2019 51 Graphics and Multimedia CG
69/70
FAQ
1. 0hy are options under the 1ilter menu grayed or not availa5le
sometimesDAns5
The most common reason for this assuming that an image is open is that
the olor mode of the image is not supported 5y the 1ilter commands. 1or
e$amples filters cannot 5e applied to Inde$ images.
2. an you open a #hotoshop 3.4 file in #hotoshop SD
Ans5
6es a #hotoshop 3.4 file can 5e opened in #hotoshop S. 8oever the
ne features of #hotoshop S may not 5e availa5le to that file. In
addition the file may not appear e$actly as created in #hotoshop 3.4.
6.an you apply a gradient on an e$isting imageD
Ans5
6es a gradient on an e$isting image can 5e applied using _uick ,asking.
To do this open the image and copy the area (or the hole image) to hichyou ant to apply a gradient. o open a ne image and click the &dit in
_uick ,ask ,ode 5utton in the tool5o$. e$t select the *radient tool and
apply a gradient in the ne image. lick the &dit in Standard ,ode 5utton.
A selection ill 5e formed on the ne image. Select &ditY#aste Into from
the main menu. The image opened first ill 5e pasted in the selection and a
gradient ill 5e applied to it.
/. an you delete the path created as an outline of an illustration using the
#en toolD
Ans5
6es the path created as an outline of an illustration using the #en tool can
5e deleted. To do this open the #aths palate right
-
8/13/2019 51 Graphics and Multimedia CG
70/70
6es it is possi5le to merge all layers 5y selecting @ayerY1latten Image
from the main menu.