SlideShare a Scribd company logo
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
ORIENTAL INSTITUTE OF SCIENCE & TTEECCHHNNOOLLOOGGYY,, BBHHOOPPAALL 
DDEEPPAARRTTMMEENNTT OOFF IINNFFOORRMMAATTIIOONN TTEECCHHNNOOLLOOGGYY 
LLAABB MMAANNUUAALL 
NNaammee:: IIMMRRAANN KKHHAANN 
CCoouurrssee CCooddee:: IITT--660022 
CCoouurrssee:: CCoommppuutteerr GGrraapphhiiccss && MMuullttiimmeeddiiaa 
SSeessssiioonn:: JJaann--JJuunn 22001144 
PPrreeppaarreedd BByy DDrr.. ((LLtt..)) SS..KK.. SShhaarrmmaa 
PPrrooff.. IImmrraann KKhhaann HHeeaadd ((IITT)) 
1
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
TTaabbllee ooff CCoonntteennttss 
Sr. No. Particulars Page No. 
1 Time Table 2 
2 University Scheme 3 
3 Syllabus 4 
4 List of Books 4 
5 List of Programs 5 
6 Important Viva Questions 43 
2
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
TTiimmee TTaabbllee 
3
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
UUnniivveerrssiittyy SScchheemmee 
4
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
SSyyllllaabbuuss 
IT-602– Computer Graphics & Multimedia 
Unit I 
Introduction to Raster scan displays, Storage tube displays, refreshing, flickring, interlacing, 
colour monitors, display processors resolution, working principle of dot matirix, inkjet laser 
printers, working principles of keyboard, mouse scanner, digitizing camera, track ball , tablets 
and joysticks, graphical input techniques, positioning techniques, rubber band techniques, 
dragging etc. 
Unit II 
Scan conversion techniques, image representation, line drawing, simple DDA, Bresenham’s 
Algorithm, Circle drawing, general method, symmetric DDA, Bresenham’s Algorithm, curves, 
parametric function, Beizier Method, B-spline Method. 
Unit III 
2D & 3D Co-ordinate system, Translation, Rotation, Scaling, Reflection Inverse 
transformation,Composite transformation, world coordinate system, screen coordinate system, 
parallel and perspective projection, Representation of 3D object on 2D screen. Point Clipping. 
Line Clipping Algorithms, Polygon Clipping algorithms, Introduction to Hidden Surface 
elimination, Basic illumination model, diffuse reflection, specular reflection, phong shading, 
Gourand shading ray tracing, color models like RGB, YIQ, CMY, HSV etc. 
Unit IV 
An Introduction – Multimedia applications – Multimedia System Architecture – Evolving 
technologies for Multimedia – Defining objects for Multimedia systems – Multimedia Data 
interface standards – Multimedia Databases.Multimedia components, Multimedia Hardware, 
SCSI, IDE, MCI, Multimedia -Tools,presentation tools, Authoring tools . 
Unit V 
Compression & Decompression – Multimedia Data & File Format standards :-TIFF, 
MIDI,JPEG,DIB, MPEG,RTF, – Multimedia I/O technologies - Digital voice and audio – 
Video image andanimation–Full motion video – Storage and retrievaltechnologies . 
4. List of Books 
SN 
o 
TITLE AUTHOR PUBLISHER / EDITION YEAR 
1 
Computer Graphics C 
Version 
Donald Hearn and M.Pauline Baker 
Pearson 
Education 
2003 
2 
Multimedia Systems and 
Design 
Prabat K Andleigh and Kiran Thakrar PHI Learning 2008 
3 
Multimedia making it 
work 
Tay Vaughan Tata McGraw Hill edition 2007 
4 Computer Graphics Amarendra N Sinha & Arun D Udai McGraw Hill publication 2011 
5 
Fundamental of 
Computer Graphics and 
Multimedia 
Mukherjee PHI Learning 2008 
LLiisstt ooff PPrrooggrraammss 
5
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Experi 
ment 
No. 
Aim Date of 
Submission 
Signature 
& 
Remarks 
1. Write a program to implement DDA line 
drawing Algorithm. 
2. Write a program to implement Bresenhams’ line 
drawing algorithm. 
3. Write a program to implement Bresenhams’ 
circle drawing algorithm. 
4. Write a program to draw an ellipse using 
Bresenhams’ algorithm. 
5. Write a program to perform various 
transformations on line , square & rectangle. 
6. Write a program to implement Cohen Sutherland 
line clipping algorithm. 
7. Write a program to convert a color given in RGB 
space to it’s equivalent HSV color space 
8. Write a program to implement JPEG 
compression scheme for still images. 
9. Write a program to implement text compression 
algorithm. 
10. To perform animation using any animation 
software. 
11. To perform basic operations on image using any 
image editing software. 
Experiment-1 
6
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Required Software/ Software Tool 
OS:Linux Operating System or Windows Operating System C/C++ 
TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. 
Objective:-To implement DDA Algorithm for drawing a Line. 
Description: To DDA algorithm is an incremental scan conversion method. Here we perform 
calculations at each step using the results from the preceding step. The characteristic of the DDA 
algorithm is to take unit steps along one coordinate and compute the corresponding values along 
the other coordinate. The unit steps are always along the coordinate of greatest change, e.g. if dx = 
10 and dy = 5, then we would take unit steps along x and compute the steps along y. 
In DDA we need to consider two cases; 
One is slope of the line less than or equal to one (|m| ≤1) and slope of the line greater than one (m| 
> 1). 
· When |m| ≤ 1 means y2-y1 = x2-x1 or y2-y1 <x2-x1.In both these cases we assume x to be 
themajor axis. Therefore we sample x axis at unit intervals and find the y values 
corresponding to each x value. We have the slope equation as 
Δ y = m Δ x 
y2-y1 = m (x2-x1) 
In general terms we can say that y i+1 - yi = m(x i+1 - xi ). But here Δ x = 1; therefore the 
equation reduces to y i+1= yi + m = yi + dy/dx. 
· When | m| > 1 means y2-y1> x2-x1 and therefore we assume y to be the major axis. Here 
we sample y axis at unit intervals and find the x values corresponding to each y value. We 
have the slope equation as 
Δ y = m Δ x 
y2-y1 = m (x2-x1) 
Algorithm : 
1. Start. 
2. Declare variables x,y,x1,y1,x2,y2,k,dx,dy,s,xi,yi and also declare gdriver=DETECT, mode. 
3. Initialize the graphic mode with the path location in TurboC3 folder. 
4. Input the two line end-points and store the left end-points in (x1,y1). 
5. Load (x1, y1) into the frame buffer; that is, plot the first point. put x=x1,y=y1. 
6. Calculate dx=x2-x1 and dy=y2-y1. 
7. If abs (dx) > abs (dy), do s=abs(dx). 
8. Otherwise s= abs(dy). 
9. Then xi=dx/s and yi=dy/s. 
10. Start from k=0 and continuing till k<s,the points will be 
i. X=x+xi. 
ii. Y=y+yi. 
11. Plot pixels using putpixel at points (X,Y) in specified color. 
12. Close Graph and stop. 
7
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Coding: 
Output:- 
8
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Experiment-2 
9
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Required Software/ Software Tool 
OS:Linux Operating System or Windows Operating System C/C++ 
TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. 
Objective:-To implement Bresenham ‘s Algorithm for drawing a Line. 
Description: 
Basic Concept: 
Move across the x axis in unit intervals and at each step choose between two different y 
coordinates 
For example, from position (2, 3) we have to choose between (3, 3) and (3, 4). We 
would like the point that is closer to the original line 
So we have to take decision to choose next point. So next pixels are selected based 
on the value of decision parameter p. The equations are given in below algorithm. 
Algorithm : 
1. Input the two line end-points, storing the left end-point in (x0, y0) 
2. Plot the point (x0, y0) 
3. Calculate the constants Δx, Δy, 2Δy, and (2Δy - 2Δx) and get the first value for the 
decision parameter as: 
4. At each xk along the line, starting at k = 0, perform the following test. If pk < 0, the next 
point to plot is (xk+1, yk ) and: 
Otherwise, the next point to plot is (xk+1, yk+1) and: 
5.Repeat step 4 (Δx – 1) times 
NOTE: The algorithm and derivation above assumes slopes are less than 1. For other slopes 
we need to adjust the algorithm slightly 
Coding: 
10
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Output:- 
11
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Experiment-3 
12
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Required Software/ Software Tool 
OS:Linux Operating System or Windows Operating System C/C++ 
TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. 
Objective:-To implement Midpoint Circle drawing Algorithm for drawing a Circle. 
Description: 
Basic Concept: 
Circles have the property of being highly symmetrical, which is handy when it comes to drawing 
them on a display screen. 
· We know that there are 360 degrees in a circle. First we see that a circle is symmetrical 
about the axis, so only the first 180 degrees need to be calculated. 
· Next we see that it's also symmetrical about the y axis, so now we only need to calculate 
the first 90 degrees. 
· Finally we see that the circle is also symmetrical about the 45 degree diagonal axis, so we 
only need to calculate the first 45 degrees. 
· We only need to calculate the values on the border of the circle in the first octant. The 
other values may be determined by symmetry. 
Bresenham's circle algorithm calculates the locations of the pixels in the first 45 degrees. It 
assumes that the circle is centered on the origin. So for every pixel (x, y) it calculates, we draw a 
pixel in each of the eight octants of the circle. This is done till when the value of the y coordinate 
equals the x coordinate. The pixel positions for determining symmetry are given in the below 
algorithm. 
Algorithm : 
1. Input radius r and circle centre (xc, yc), then set the coordinates for the first point on the 
circumference of a circle centred on the origin as: 
2. Calculate the initial value of the decision parameter as: 
3. Starting with k = 0 at each position xk, perform the following test. If pk < 0, the next point 
along the circle centred on (0, 0) is (xk+1, yk) and: 
13
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Otherwise the next point along the circle is (xk+1, yk-1) and: 
4. Determine symmetry points in the other seven octants 
5. Move each calculated pixel position (x, y) onto the circular path centred at (xc, yc) to plot the 
coordinate values: 
6. Repeat steps 3 to 5 until x >= y 
Symmetric pixel positions: 
· putpixel(xc+x,yc-y,GREEN); //For pixel (x,y) 
· putpixel(xc+y,yc-x, GREEN); //For pixel (y,x) 
· putpixel(xc+y,yc+x, GREEN); //For pixel (y,-x) 
· putpixel(xc+x,yc+y, GREEN); //For pixel (x,-y) 
· putpixel(xc-x,yc+y, GREEN); //For pixel (-x,-y) 
· putpixel(xc-y,yc+x, GREEN); //For pixel (-y,-x) 
· putpixel(xc-y,yc-x, GREEN); //For pixel (-y,x) 
· putpixel(xc-x,yc-y, GREEN); //For pixel (-x,y) 
Coding: 
14
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Output: 
15
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Experiment-4 
16
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Required Software/ Software Tool 
OS:Linux Operating System or Windows Operating System C/C++ 
TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. 
Objective:- To implement Mid-Point Ellipse drawing Algorithm for drawing an ellipse. 
Description: 
Basic Concept: 
Midpoint ellipse algorithm is a method for drawing ellipses in computer graphics.This method is 
modified from Bresenham’s algorithm. The advantage of this modified method is that only 
addition operations are required in the program loops. This leads to simple and fast 
implementation in all processors. 
Let us consider one quarter of an ellipse. The curve is divided into two regions. In region I, the 
slope on the curve is greater than –1 while in region II less than –1. 
Algorithm : 
1. Set RXSq = RX * RX 
2. Set RYSq = RY * RY 
3. Set X = 0 and Y = RY 
4. Set PX = 0 and PY = 2 * RXSq * Y 
5. Call Draw Elliplse(XC, YC, X, Y) 
6. Set P = RYSq – (RXSq * RY) + (0.25 * RXSq) [Region 1] 
7. Repeat While (PX < PY) 
8. Set X = X + 1 
9. PX = PX + 2 * RYSq 
10. If (P < 0) Then 
11. Set P = P + RYSq + PX 
12. Else 
13. Set Y = Y – 1 
14. Set PY = PY – 2 * RXSq 
15. Set P = P + RYSq + PX – PY 
17
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
[End of If] 
16. Call Draw Elliplse(XC, YC, X, Y) 
[End of Step 7 While] 
17. Set P = RYSq*(X + 0.5)2+RXSq*(Y – 1)2–RXSq*RYSq [Region 2] 
18. Repeat While (Y > 0) 
19. Set Y = Y – 1 
20. Set PY = PY – 2 * RXSq 
21. If (P > 0) Then 
22. Set P = P + RXSq – PY 
23. Else 
24. Set X = X + 1 
25. Set PX + 2 * RYSq 
26. Set P = P + RXSq – PY + PX 
[End of If] 
27. Call Draw Ellipse(XC, YC, X, Y) 
[End of Step 18 While] 
28. Exit 
Coding: 
18
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Output: 
19
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Experiment-5 
20
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Required Software/ Software Tool 
OS:Linux Operating System or Windows Operating System C/C++ 
TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. 
Objective:-Write a C-program for performing the basic 2D transformations such as 
translation, Scaling, Rotation,shearing and reflection for a given 2D object. 
Description: 
Basic Concept: 
We have to perform 2D transformations on 2D objects. Here we perform transformations on a line 
segment.The 2D transformations are: 
1. Translation 
2. Scaling 
3. Rotation 
4. Reflection 
5. Shear 
1. Translation: Translation is defined as moving the object from one position to another position 
along straight line path. 
We can move the objects based on translation distances along x and y axis. tx denotes translation 
distance along x-axis and ty denotes translation distance along y axis. 
Translation Distance: It is nothing but by how much units we should shift the object from one 
location to another along x, y-axis. Consider (x,y) are old coordinates of a point. Then the new 
coordinates of that same point (x’,y’) can be obtained as follows: 
X’=x+tx 
Y’=y+ty 
We denote translation transformation as P. we express above equations in matrix form as: 
2. Scaling: scaling refers to changing the size of the object either by increasing or decreasing. We 
will increase or decrease the size of the object based on scaling factors along x and y-axis. If (x, y) 
are old coordinates of object, then new coordinates of object after applying scaling transformation 
are obtained as: 
x’=x*sx 
y’=y*sy. 
sx and sy are scaling factors along x-axis and y-axis. 
21
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
3. Rotation: A rotation repositions all points in an object along a circular path in the plane 
centered at the pivot point. We rotate an object by an angle theta. New coordinates after rotation 
depend on both x and y 
x’ = xcosθ -y sinθ 
y’ = xsinθ+ ycosθ 
or in matrix form: 
P' = R • P, 
R-rotation matrix. 
4. Reflection: Reflection is nothing but producing mirror image of an object. Reflection can be 
done just by rotating the object about given axis of reflection with an angle of 180 degrees 
5. Shear: 
1. Shear is the translation along an axis by an amount that increases linearly with another axis (Y). 
Itproduces shape distortions as if objects were composed of layers that are caused to slide over 
each other. 
2. Shear transformations are very useful in creating italic letters and slanted letters from regular 
letters. 
3. Shear transformation changes the shape of the object to a slant position. 
4. Shear transformation is of 2 types: 
a. X-shear: changing x-coordinate value and keeping y constant 
x’=x+shx*y 
y’=y 
b. Y-shear: changing y coordinates value and keeping x constant 
x’=x 
y’=y+shy*x 
shx and shy are shear factors along x and y-axis. 
22
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Coding: 
23
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
24
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Output: 
25
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Experiment-6 
Required Software/ Software Tool 
OS:Linux Operating System or Windows Operating System C/C++ 
TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. 
Objective:-Write a program to implement Cohen Sutherland line clipping algorithm. 
Description: 
Basic Concept: 
This method speeds up the processing of line segments by performing initial tests that reduce the 
number of intersections that must be calculated. Every line endpoint is assigned to four digit, 
binary code called region code. Region code identifies the location of the pint relative to the 
boundaries of the clipping rectangle. 
Bit 1: left 
Bit 2: right 
Bit 3: below 
Bit 4: above 
Syntaxes & keywords: 
Drawpoly function is used to draw polygons i.e. triangle, rectangle, pentagon, hexagon etc. 
Declaration :- void drawpoly( int num, int *polypoints ); 
outtextxy function display text or string at a specified point(x,y) on the screen. 
Declaration :- void outtextxy(int x, int y, char *string); 
For a line segment with endpoints (x1,y1) and (x2,y2) and one or both endpoints outside the 
clipping rectangle, the parametric representation is, 
X = x1+u(x2-x1) 
Y= y1+u(y2-y1) 
Algorithm: 
Step 1: Start 
Step 2: Get the bottom-left coordinate of view port from the user. 
Step 3: Get the top-right coordinate of view port from the user. 
Step 4: Get the coordinates of 1st end point of line from the user. 
Step 5: Get the coordinates of 2nd endpoint of line from the user. 
Step 6: Print the region code of the first and second point. 
Step 7: If the points lie inside the view port, print ‖The line is totally visible. 
Step 8: If the starting point lies outside the view port, print ―The line is invisible. 
Step 9: If the starting point lies inside the view port and the ending point lies outside the view port, 
print ―The line is partially visible 
Step 10: Clip the line present outside the view port. 
Step 11: Draw the clipped line present inside the view port. 
Step 12: Stop 
26
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Coding: 
27
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Output: 
28
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Experiment-7 
Required Software/ Software Tool 
OS:Linux Operating System or Windows Operating System C/C++ 
TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. 
Objective:-Write a program to convert a color given in RGB space to it’s equivalent HSV 
color space. 
Description: 
The Objective can be achieved by transformed the parameters of HSV to the RGB settings 
needed for the color monitor. Transformation from HSV parameters to RGB parameters by 
determining the inverse of the equations in rgbToHsv procedure. 
Syntaxes & keywords commands for achieving the objective 
void hsvtorgb(float h,float s,float v,float *r,float *g,float *b) 
void rgbtohsv(float r,float g,float b,float *h,float *s,float *v) 
void hsvtorgb(float h,float s,float v,float *r,float *g,float *b) 
Description about the parts of the program with description about the language constructs 
used for the same. Here passing pointers to (addresses of) r, g, and b - and the function is 
returning the r,g,b values. 
· hue in degrees (360.0) 
· saturation in percent (0.0 - 1.0) 
· value/brightness in percent (0.0-1.0) 
void rgbtohsv(float r,float g,float b,float *h,float *s,float *v) 
Here passing pointers to (addresses of) h, s, and v - and the function is returning the h,s,v 
values 
Algorithm: 
HSV to RGB 
1. Read the H, S, V values in the range 0 to 1. 
2. If the value of s is 0 then it is gray scale and the R, G, B becomes the value of 
V. 
3. If the value of h is 1.0 then assign h=0 else h=h*6.0 and perform the following 
i= floor(h); f=h-i; 
aa=v*(1-s); bb=v*(1-s*f); cc=v*(1-s*(1f))); 
4. Based on the i value assign v, aa, bb ,cc to RGB and display the RGB values. 
RGB to HSV 
1. Read the R, G, B values. 
2. Find the min,max value among the RGB values 
3. Assign the maximum value to V. 
4. S value is calculated by (max-min)/max. 
5. H value is calculated by comparing R, G, and B values to max value. 
6. Display the H, S and V values. 
29
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Coding: 
30
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
OutPut: 
31
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Experiment-8 
Required Software/ Software Tool 
OS:Linux Operating System or Windows Operating System C/C++ 
TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. 
Objective:-Write a program to implement JPEG compression scheme for still images. 
Description: 
The basic idea behind this method of compression is to treat a digital image as an array of 
numbers i.e., a matrix. Each image consists of a fairly large number of little squares called 
pixels. 
Objective: 
The main Objective is to reduce irrelevance and redundancy of the image data in order to be 
able to store or transmit data in an efficient form. 
How it is being achieved? 
It can be achieved by using image compression techniques. 
Syntaxes & keywords commands for achieving the objectiv 
· import java.util.zip.*; 
· FileInputStream() 
· DeflaterOutputStream 
Description about the parts of the program with description about the language 
constructs 
used for the same. 
import java.util.zip.*; - Provides classes for reading and writing the standard ZIP and GZIP 
file formats. 
FileInputStream() - FileInputStream is meant for reading streams of raw bytes such as image 
data. For reading streams of characters, consider using FileReader. DeflaterOutputStream - 
This class implements an output stream filter for compressing data in the 
"deflate" compression format. 
Algorithm 
1. File input stream class is used to access the input file 
2. Read the content of the image file and assign to a variable 
3. write the value to an object 
4. Repeat the step 3 until end of file. 
5. Print the size of the compressed image . 
32
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Coding: 
33
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Output: 
34
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Experiment-9 
Required Software/ Software Tool 
OS:Linux Operating System or Windows Operating System C/C++ 
TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. 
Objective:-Write a program to implement text compression algorithm. 
Description: 
Run Length Encoding (RLE) is a simple and popular data compression algorithm. It is based 
on the idea to replace a long sequence of the same symbol by a shorter sequence and is a good 
introduction into the data compression field. For instance, text files with large runs of spaces 
or tabs may compress well with this algorithm. 
Objective: 
The main Objective is to compress the data without any loss using text compression algorithm. 
How it is being achieved? 
It can be achieved by replace a long sequence of the same symbol by a shorter sequence of a 
symbol. 
Syntaxes & keywords commands for achieving the objectiv 
· gets(str); used to get the string from the userFileInputStream() 
Algorithm: 
1. Read the message. 
2. Check the first character with the next character. 
3. If it is same, then increment the count and check the next character. 
4. Repeat the step 2 & 3 till reads the null character. 
5. Display the encoded message 
35
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Coding: 
36
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Output: 
37
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Experiment-10 
Required Software/ Software Tool 
OS: Windows Operating System 
TOOLS/APPARATUS: Adobe Flash Player. 
Objective: - To perform animation using any animation software. 
Description: 
Animation is anything that moves on your screen like a cartoon character. Time sequence of 
visual images on a scene. It can be achieved by using animation software like Swiss, flash 
Algorithm: 
Motion Tweening 
Step 1: Create an object in the first layer of first key frame. 
Step 2: Create the last key frame and move the object to it. 
Step 3: Right click on the first key frame and select create motion tween. 
Step 4: Play the picture. 
Shape Tweening 
Step 1: Create an object in the first layer of first key frame. 
Step 2: Create the last key frame. 
Step 3: In first key frame’s properties and select shape tween. 
Step 4: Change the shape of the object at the last frame. 
Step 5: Play the picture. 
Guide Layer 
Step 1: Create an object in the first layer of first key frame. 
Step 2: Create the last key frame and move the object to it. 
Step 3: Right click on the first key frame and select create motion tween. 
Step 4: Right click on the object’s layer select add motion guide. 
Step 5: In motion guide draw your guide line. 
Step 6: Play the picture. 
Masking 
Step 1: Create an object in the first layer of first key frame 
Step 2: Add new layer and draw the shape of the view. 
38
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Step 3: Add the motion guide to the view tool. 
Step 4: Right click on the second layer (view layer) and select mask. 
Step 5: Play the picture. 
Output 
Shape Tweening 
Motion Tweening 
39
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Guide Layer 
40
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Masking 
Experiment-11 
Required Software/ Software Tool 
OS: Windows Operating System 
TOOLS/APPARATUS: Adobe Flash Player. 
Objective: - To perform basic operations on image using any image editing software. 
Description: 
Adobe Photoshop is a graphics editing program developed and published by Adobe Systems. 
Photoshop is a tool that helps design sequences for videos and films by removing the 
guesswork for film and video professionals. 
Procedure: 
The Brush Popup Palette 
Allow quick, convenient access to a range of standard, preset brushes. 
The Brushes Palette 
Provides access to a wide variety of options for controlling the appearance and characteristics 
of brush. 
The Pencil Tool 
Used to draw free form lines. These draws with the foreground color. 
41
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
The Gradient Tool 
Used to color pixels with the foreground color based on tolerance setting. 
The Paint Bucket Tool 
Used to color pixels with the foreground color on the tolerance setting. 
Cropping An Image 
Digital editors are used to crop images. Cropping creates a new image by selecting a desired 
rectangular portion from the image being cropped. The unwanted part of the image is 
discarded. Image cropping does not reduce the resolution of the area cropped. A primary 
reason for cropping is to improve the image composition in the new image. 
Removal of Unwanted Elements 
Most image editors can be used to remove unwanted branches, etc., using a "clone" tool. 
Image Orientation 
Image orientation (from left to right): original, -30° CCW rotation, and flipped. 
Sharpening And Softening Images 
Graphics programs can be used to both sharpen and blur images in a number of ways, such as 
unsharp masking or deconvolution. 
Editing 
· Open your project file and create a duplicate. 
· Crop the image using crop tool. 
· Change the image size using canvas technique. 
Back Ground Changing 
· Select the area to change the back ground using magic wand tool. 
· Select the back ground image for your image. 
· Move the shape of the back ground using marquee tool. 
· Using selection tool, move the back ground. 
Changing Color 
· Select the area using Lasso tool . 
· Go to image tab and adjustments and select the Hue / saturation option. 
· Change the color using RGB mode. 
Output 
42
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Results 
43
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
IImmppoorrttaanntt VViivvaa QQuueessttiioonnss 
1. What is scan conversion? 
A major task of the display processor is digitizing a picture definition given in an application 
program into a set of pixel-intensity values for storage in the frame buffer. This digitization 
process is called scan conversion. 
2. Write the properties of video display devices? 
Properties of video display devices are persistence, resolution, and aspect ratio. 
3. What is rasterization? 
The process of determining the appropriate pixels for representing picture or graphics object is 
known as rasterization. 
4. Define Computer graphics. 
Computer graphics remains one of the most existing and rapidly growing computer fields. 
Computer graphics may be defined as a pictorial representation or graphical representation of 
objects in a computer. 
44
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
5. Name any four input devices. 
Four input devices are keyboard, mouse, image scanners, and trackball. 
6. Write the two techniques for producing color displays with a CRT? 
Beam penetration method, shadow mask method 
7. What is vertical retrace of the electron beam? 
In raster scan display, at the end of one frame, the electron beam returns to the left top corner 
of the screen to start the next frame, is called vertical retrace of the electron beam. 
8. Short notes on video controller? 
Video controller is used to control the operation of the display device. A fixed area of the 
system is reserved for the frame buffer, and the video controller is given direct access to the 
frame buffer memory. 
9. What is bitmap? 
Some system has only one bit per pixel; the frame buffer is often referred to as bitmap. 
10. Differentiate plasma panel display and thin film electro luminescent display? 
In plasma panel display, the region between two glass plates is filled with neon gas. In thin 
film electro luminescent display, the region between two glasses plates are filled with 
phosphor, such as zinc sulphide doped with manganese. 
11. What is resolution? 
The maximum number of points that can be displayed without overlap on a CRT is referred to 
as the resolution. 
12. What is horizontal retrace of the electron beam? 
In raster scan display, the electron beam return to the left of the screen after refreshing each 
scan line, is called horizontal retrace of the electron beam. 
13. What is filament? 
In the CRT, heat is applied to the cathode by directing a current through a coil of wire, is 
called filament. 
14. What is pixmap? 
Some system has multiple bits per pixel, the frame buffer is often referred to as pixmap. 
15. Write the types of clipping? 
Point clipping, line clipping, area clipping, text clipping and curve clipping. 
16. What is meant by scan code? 
When a key is pressed on the keyboard, the keyboard controller places a code carry to the key 
pressed into a part of the memory called as the keyboard buffer. This code is called as the scan 
code. 
17. List out the merits and demerits of Penetration techniques? 
The merits and demerits of the Penetration techniques are as follows 
45
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
• It is an inexpensive technique 
• It has only four colors 
• The quality of the picture is not good when it is compared to other techniques 
• It can display color scans in monitors 
• Poor limitation etc. 
18. List out the merits and demerits of DVST? 
The merits and demerits of direct view storage tubes [DVST] are as follows 
• It has a flat screen 
• Refreshing of screen is not required 
• Selective or part erasing of screen is not possible 
• It has poor contrast Performance is inferior to the refresh CRT. 
19. What do you mean by emissive and non-emissive displays? 
The emissive display converts electrical energy into light energy. The plasma panels, thin film 
electro-luminescent displays are the examples. The Non-emissive are optical effects to convert 
the sunlight or light from any other source to graphic form. Liquid crystal display is an 
example. 
20. List out the merits and demerits of Plasma panel display? 
Merits 
• Refreshing is not required 
• Produce a very steady image free of Flicker 
• Less bulky than a CRT. 
Demerits 
• Poor resolution of up to 60 d.p.i 
• It requires complex addressing and wiring 
• It is costlier than CRT. 
21. What is persistence? 
The time it takes the emitted light from the screen to decay one tenth of its original intensity is 
called as persistence. 
22. What is Aspect ratio? 
The ratio of vertical points to the horizontal points necessary to produce length of lines in both 
directions of the screen is called the Aspect ratio. Usually the aspect ratio is ¾. 
23. What is the difference between impact and non-impact printers? 
Impact printer press formed character faces against an inked ribbon on to the paper. A line 
printer and dot-matrix printer are examples. 
Non-impact printer and plotters use Laser techniques, inkjet sprays, Xerographic process, 
electrostatic methods and electro thermal methods to get images onto the papers. Examples 
are: Inkjet/Laser printers. 
24. Define pixel? 
Pixel is shortened forms of picture element. Each screen point is referred to as 
pixel or pel. 
25. What is frame buffer? 
Picture definition is stored in a memory area called frame buffer or refresh buffer. 
46
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
26. Where the video controller is used? 
A special purpose processor, which is used to control the operation of the display device, is 
known as video controller or display controller. 
27. What is run length encoding? 
Run length encoding is a compression technique used to store the intensity values in the frame 
buffer, which stores each scan line as a set of integer pairs.One number each pair indicates an 
intensity value, and second number specifies the number of adjacent pixels on the scan line 
that are to have that intensity value. 
28. What is point in the computer graphics system? 
The point is a most basic graphical element & is completely defined by a pair of user 
coordinates (x, y). 
29. Write short notes on lines? 
A line is of infinite extent can be defined by an angle of slope q and one point on the line 
P=P(x,y). This can also be defined as y=mx+C where C is the Yintercept. 
30. Define Circle? 
Circle is defined by its center xc, yc and its radius in user coordinate units.The equation of the 
circle is (x-xc) + (y-yc) = r2. 
31. What are the various attributes of a line? 
The line type, width and color are the attributes of the line. The line type include solid line, 
dashed lines, and dotted lines. 
32. What is antialiasing? 
The process of adjusting intensities of the pixels along the line to minimize the effect of 
aliasing is called antialiasing. 
33. What is Transformation? 
Transformation is the process of introducing changes in the shape size and orientation of the 
object using scaling rotation reflection shearing & translation etc. 
34. What is translation? 
Translation is the process of changing the position of an object in a straight-line path from one 
coordinate location to another. Every point (x , y) in the object must undergo a displacement 
to (x|,y|). the transformation is: x| = x + tx ; y| = y+ty 
35. What is rotation? 
A 2-D rotation is done by repositioning the coordinates along a circular path, in the x-y plane 
by making an angle with the axes. The transformation is given by: X| = r cos (q + f) and Y| = r 
sin (q + f). 
36. What is scaling? 
47
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
A 2-D rotation is done by repositioning the coordinates along a circular path, in the x-y plane 
by making an angle with the axes. The transformation is given by: X| = r cos (q + f) and Y| = r 
sin (q + f). 
37. What is shearing? 
The shearing transformation actually slants the object along the X direction or the Y direction 
as required. ie; this transformation slants the shape of an object along a required plane. 
38. What is reflection? 
The reflection is actually the transformation that produces a mirror image 
of an object. For this use some angles and lines of reflection. 
39. What are the two classifications of shear transformation? 
X shear, y shear. 
40. A point (4,3) is rotated counterclockwise by an angle of 45°. Find the rotation 
matrix and the resultant point. 
41. Name any three font editing tools. 
ResEdit, FONTographer, 
42. Differentiate serif and sans serif fonts. Give one example 
Serif fonts has a little decoration at the end of the letter, but serif font has not. Times, new 
century schoolbook is the examples of serif fonts. Arial, potima are examples for sans serif 
fonts. 
43. Distinguish between window port & view port? 
A portion of a picture that is to be displayed by a window is known as window port. The 
display area of the part selected or the form in which the selected part is viewed is known as 
view port. 
44. Define clipping? 
Clipping is the method of cutting a graphics display to neatly fit a predefined graphics region 
or the view port 
45. What is the need of homogeneous coordinates? 
To perform more than one transformation at a time, use homogeneous coordinates or matrixes. 
They reduce unwanted calculations intermediate steps saves time and memory and produce a 
sequence of transformations. 
46. Distinguish between uniform scaling and differential scaling? 
When the scaling factors sx and sy are assigned to the same value, a uniform scaling is 
produced that maintains relative object proportions. Unequal values for sx and sy result in a 
differential scaling that is often used in design application. 
47. What is fixed point scaling? 
The location of a scaled object can be controlled by a position called the fixed point that is to 
remain unchanged after the scaling transformation. 
48. What is Bezier Basis Function? 
48
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Bezier Basis functions are a set of polynomials, which can be used instead of the primitive 
polynomial basis, and have some useful properties for interactive curve design. 
49. What is surface patch 
A single surface element can be defined as the surface traced out as two parameters (u, v) take 
all possible values between 0 and 1 in a two-parameter representation. Such a single surface 
element is known as a surface patch. 
50. Define B-Spline curve? 
A B-Spline curve is a set of piecewise(usually cubic) polynomial segments that pass close to a 
set of control points. However the curve does not pass through these control points, it only 
passes close to them. 
51. What is a spline? 
To produce a smooth curve through a designed set of points, a flexible strip called 
spline is used. Such a spline curve can be mathematically described with a piecewise 
cubic polynomial function whose first and second derivatives are continuous across 
various curve section. 
52. What are the different ways of specifying spline curve? 
• Using a set of boundary conditions that are imposed on the spline. 
• Using the state matrix that characteristics the spline 
• Using a set of blending functions that calculate the positions along the curve path by 
specifying combination of geometric constraints on the curve 
53. What are the important properties of Bezier Curve? 
• It needs only four control points 
• It always passes through the first and last control points 
• The curve lies entirely within the convex half formed by four control points. 
54. Define Projection? 
The process of displaying 3D into a 2D display unit is known as projection. The projection 
transforms 3D objects into a 2D projection plane 
55. What are the steps involved in 3D transformation? 
• Modeling Transformation 
• Viewing Transformation 
• Projection Transformation 
• Workstation Transformation 
56. What do you mean by view plane? 
A view plane is nothing but the film plane in camera which is positioned and oriented for a 
particular shot of the scene. 
57. Define projection? 
The process of converting the description of objects from world coordinates to viewing 
coordinates is known as projection 
58. What you mean by parallel projection? 
49
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
Parallel projection is one in which z coordinates is discarded and parallel lines from each 
vertex on the object are extended until they intersect the view plane. 
59. What do you mean by Perspective projection? 
Perspective projection is one in which the lines of projection are not parallel. Instead, they all 
converge at a single point called the center of projection. 
60. What is Projection reference point? 
In Perspective projection, the lines of projection are not parallel. Instead, they all converge at a 
single point called Projection reference point. 
61. Define computer graphics animation? 
Computer graphics animation is the use of computer graphics equipment where the graphics 
output presentation dynamically changes in real time. This is often also called real time 
animation. 
62. What is tweening? 
It is the process, which is applicable to animation objects defined by a sequence of points, and 
that change shape from frame to frame. 
63. Define frame? 
One of the shape photographs that a film or video is made of is known as frame. 
64. What is key frame? 
One of the shape photographs that a film or video is made of the shape of an object is known 
initially and for a small no of other frames called key frame 
65. Define Multimedia 
Multimedia is the use of the computer to present and combine text, graphics, audio and video 
with links and tools that lets the user to navigate, interact, create and communicate. 
66. What is multimedia PC: 
A multimedia PC is a computer that has a CD-ROM or DVD drive and supports 8-bit and 16- 
bit waveform audio recording and playback, MIDI sound synthesis, and MPEG movie 
watching, with a central processor fast enough and a RAM large enough to enable the user to 
play and interact with these media in real time, and with a hard disk large enough to store 
multimedia works that the user can create. 
67. Where to use multimedia? 
Multimedia improves information relation. Multimedia applications include the following: 
• Business 
• Schools 
• Home 
• Public place 
68. List out the benefits of multimedia 
Benefits of multimedia are 
· Training 
· Sales 
· Communications 
· Medicines 
50
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
69. What is hypermedia? 
A set of documents in which a given document can contain text, graphics video and audio 
clips as well as embedded references to other documents world wide web pages are 
hypermedia documents. 
70. What is hypertext? 
Hyper text is an application of indexing text to provide a rapid search of specific text strings in 
one or more documents. Hypertext is an integral part of hypermedia documents. In multimedia 
applications, a hypermedia documents is the basic complex object of which text is a sub-object. 
Other sub-objects in the basic object include images, sound, and full-motion video. 
71. List out the building blocks of multimedia. 
· Text 
· Image 
· Sound 
· Animation, Video 
72. What are the main functions of a multimedia development system? 
Multimedia development system must perform main three functions as follows: 
· Input data 
· Development 
· Data output 
Data input from sources such as cameras or musical instruments, application development, 
and data output to some delivery medium such as a videodisk or CD-ROM. 
73. Define Typeface 
Typeface is measured in point sizes, where one point is approximately 
1/72 of an inch. It is a measure of the height of the metal blocks containing letters. 
74. Define the following: 
(i) X-height (ii) Set (iii) Kerning 
(i.)X-height: The X-height is the measurement of the height of the character X, in other words 
of the middle bit without any ascender or descender. 
(ii) Set: The width of the letters is called the set and is fixed relative to the point-size. 
(iii) Kerning: The spaces between letters in one world (tracking) can be adjusted in a process 
called kerning. 
75. Define the following respective to sound: 
(i) Waveform (ii) Frequency (iii) Amplitude 
i) Waveform 
Sound is produced by the vibration of matter. During the vibration pressure variation are 
created in the air surrounding it. The pattern of the oscillation is called a waveform. 
(ii) Frequency 
The frequency of the sound is the reciprocal value of the period. It represents the number of 
period s in a second and it is measured in Hertz (Hz) or cycles per second. 
51
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
(iii) Amplitude 
A sound also has amplitude. The amplitude of a sound is a measure of the displacement of the 
air pressure wave from its, or quiescent state. 
76. Define quantization (or) resolution? 
The resolution (or) quantization of a sample value depends on the number of bits used in 
measuring the height of the waveform. An 8-bit quantization yields 256 possible values, 16-bit 
CD-qudra quantization results in over 65536 values. 
77. What are the types of sound objects that can be used in multimedia production? 
There are four types of sound objects that can be used in multimedia production: 
· Waveform audio 
· MIDI sound tracks 
· Compact disc (CD) audio 
· MP3 files 
78. What is MIDI? 
Musical Instrument Digital Interface (MIDI) is the interface between electronic musical 
instruments and computers is a small piece of equipment that plugs directly into the 
computer’s serial port and allows the transmission of music signal. MIDI is considered to be 
the most compact interface that allows full-scale output. 
79. List out the components of MIDI interface. 
A MIDI interface has two different components: 
· Hardware 
· Data format 
Hardware connects the equipment. It specifies the physical connection between musical 
instruments, stimulate that a port MIDI port is built into an instrument, specifies a MIDI cable 
and deals with electronic signals t that are sent over the cable. 
Data format encodes the information traveling through the hardware MIDI data format 
includes an instrument –connected data format. The encoding includes, besides the instrument 
specification, the notion of the beginning and end of a note, basic frequency and sound 
volume; MIDI data allow an encoding of about 10 octaves, which corresponds to 128 notes. 
80. Define the term flicker in video. 
A periodic fluctuation of brightness perception is called flicker effect. 
81. Define Random scan/Raster scan displays? 
Random scan is a method in which the display is made by the electronic beam which is 
directed only to the points or part of the screen where the picture is to be drawn. 
The Raster scan system is a scanning technique in which the electrons sweep from top to 
bottom and from left to right. The intensity is turned on or off to light and unlight the pixel. 
82. What is an MPC? 
The MPC computer is not a hardware unit but rather a standard that includes minimum 
specifications to turn Intel microprocessor-based computers into multimedia computers. 
83. List all the MPC standards 
52
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
There are currently three MPC standards as follows 
· MPC Level 1 
· MPC Level 2 
· MPC Level 3 
The standards apply not only to desktop computers but also to increasingly more powerful 
multimedia laptops. 
84. What is configuration of MPC level 1 standards? 
The MPC level 1 minimum standard workstation consisted of a 16MHz 386SX 
microprocessor, atleast 2MB of RAM, a 30MB Hard disk, a CD-ROM drive, VGA video (16 
colors), an 8-bit audio board, speakers and/or headphones, and Microsoft windows software 
with the Multimedia Extensions package. 
85. Write the configuration of MPC level 2 standards. 
MPC level 2 minimum standard consisted of a 25MHz 486SX microprocessor with atleast 
4MB of RAM, a 3.5-inch high density, a 160 MB or larger hard disk drive, and a CD-ROM 
drive capable of sustained 300k per second transfer rate with CD-DA outputs and volume 
control, 16-bit sound capability with microphone input, and a color monitor with display 
resolution of atleast 640X 480 with 65,536(64k) colors. 
86. List out the input devices of multimedia. 
Input devices for a multimedia system are as follows: 
· Keyboards 
· Mouse 
· Trackball 
· Touch screen 
· Magnetic card Encoders and Readers 
· Graphics Tablets 
· Scanners 
· Optical Character Recognition (OCR) devices 
· Voice Recognition Systems 
· Digital cameras 
87. What is a Video disk? 
Video disk serves as the output of motion pictures and audio. The data are stored in an analog-coded 
format on the disk. The reproduced data meet the highest quality requirements. Video 
disk has a diameter of approximately 30cm and stores approximately 2.6 Giga bytes. 
88. What is synchronization? 
Integration of the different media is given through a close relation between information units. 
This is called synchronization. 
89. What is meant by Multimedia User Interface? 
Multimedia user interface is a computer interface that communicates with users multiple 
media. 
90. Define the following terms: 
(i) Compression Ratio (ii) Image Quality 
53
Lab Manual: Computer Graphics & Multimedia Department of Information Technology 
(i) Compression Ratio: The Compression Ratio represents the size of the original image 
divided by the size of the compressed image. 
(ii) Image Quality: Compression ratio typically affects picture quality, the higher the 
compression ratio, the lower the quality of the decompressed image. 
91. What are the higher levels of multimedia communication system (MCS)? 
The higher layers of the multimedia communication system are divided into two architectural 
subsystems: 
• Application subsystem 
• Transport subsystem. 
92. Define collaborative computing environment? 
The recent infrastructure of networked workstations and pcs, and the availability of audio and 
video at these end points, makes it easier to people to cooperate and bridge space and time. In 
this way, network connectivity and endpoint integration of multimedia provide users with a 
collaborative computing environment. It is generally known as computer supported 
cooperative work (CSCW). 
93. List out the tools for collaborative computing 
The tools used for collaborative computing are as follows: 
• Electronic mail 
• Bulletin boards(e.g. Usenet news) 
• Screen sharing tools(e.g. show me from sunsoft) 
• Text-based conferencing systems (e.g. Internet relay chat, CompuServe, America 
online). 
• Telephone conference systems. 
• Conference rooms(e.g. video window from Bellcore) 
• Video conference systems(e.g.,Mbone tools) 
54

More Related Content

PDF
Computer graphics lab manual
Ankit Kumar
 
DOCX
Computer graphics
shafiq sangi
 
DOC
COMPUTER GRAPHICS LAB MANUAL
Vivek Kumar Sinha
 
PDF
Computer graphics lab manual
Uma mohan
 
PDF
Computer graphics practical(jainam)
JAINAM KAPADIYA
 
DOCX
Graphics practical lab manual
Vivek Kumar Sinha
 
PDF
Cg lab cse-v (1) (1)
Surya Sukumaran
 
Computer graphics lab manual
Ankit Kumar
 
Computer graphics
shafiq sangi
 
COMPUTER GRAPHICS LAB MANUAL
Vivek Kumar Sinha
 
Computer graphics lab manual
Uma mohan
 
Computer graphics practical(jainam)
JAINAM KAPADIYA
 
Graphics practical lab manual
Vivek Kumar Sinha
 
Cg lab cse-v (1) (1)
Surya Sukumaran
 

What's hot (20)

DOCX
Computer graphics lab assignment
Abdullah Al Shiam
 
PDF
Basics of Computer graphics lab
Priya Goyal
 
PDF
Computer Graphics Lab
Neil Mathew
 
DOC
Computer graphics
Prianka Padmanaban
 
DOC
SE Computer, Programming Laboratory(210251) University of Pune
Bhavesh Shah
 
DOCX
Computer Graphics Lab File C Programs
Kandarp Tiwari
 
DOCX
Computer Graphics Practical
Neha Sharma
 
PPTX
Introduction to graphics programming in c
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Computer graphics lab report with code in cpp
Alamgir Hossain
 
DOCX
Advance java
Vivek Kumar Sinha
 
PDF
C Graphics Functions
SHAKOOR AB
 
DOCX
Cg my own programs
Amit Kapoor
 
PPT
Lecture on graphics
Rafi_Dar
 
DOCX
Computer graphics
amitsarda3
 
DOCX
C graphics programs file
shubham kanojia
 
DOCX
Wap in c to draw a line using DDA algorithm
Kapil Pandit
 
PDF
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
Austin Benson
 
PPTX
Graphics in C programming
Kamal Acharya
 
PPT
computer graphics practicals
Manoj Chauhan
 
PDF
Computer graphics 2
Prabin Gautam
 
Computer graphics lab assignment
Abdullah Al Shiam
 
Basics of Computer graphics lab
Priya Goyal
 
Computer Graphics Lab
Neil Mathew
 
Computer graphics
Prianka Padmanaban
 
SE Computer, Programming Laboratory(210251) University of Pune
Bhavesh Shah
 
Computer Graphics Lab File C Programs
Kandarp Tiwari
 
Computer Graphics Practical
Neha Sharma
 
Introduction to graphics programming in c
baabtra.com - No. 1 supplier of quality freshers
 
Computer graphics lab report with code in cpp
Alamgir Hossain
 
Advance java
Vivek Kumar Sinha
 
C Graphics Functions
SHAKOOR AB
 
Cg my own programs
Amit Kapoor
 
Lecture on graphics
Rafi_Dar
 
Computer graphics
amitsarda3
 
C graphics programs file
shubham kanojia
 
Wap in c to draw a line using DDA algorithm
Kapil Pandit
 
Tall-and-skinny Matrix Computations in MapReduce (ICME MR 2013)
Austin Benson
 
Graphics in C programming
Kamal Acharya
 
computer graphics practicals
Manoj Chauhan
 
Computer graphics 2
Prabin Gautam
 
Ad

Similar to Cgm Lab Manual (20)

PDF
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
RajJain516913
 
PPTX
computer graphics-C/C++-dancingdollcode
Bhavya Chawla
 
PDF
raster algorithm.pdf
Mattupallipardhu
 
PPTX
Computer Graphics Unit 1
aravindangc
 
PDF
module 1.pdf
KimTaehyung188352
 
PDF
Computer Graphics Notes 2.pdf
AOUNHAIDER7
 
PDF
Computer Graphics involves technology to access. The Process transforms and p...
ErNandiniDharne
 
PDF
Computer graphics notes watermark
RAJKIYA ENGINEERING COLLEGE, BANDA
 
PDF
Unit 2
ypnrao
 
PPT
Line drawing algorithm and antialiasing techniques
Ankit Garg
 
PPTX
4 CG_U1_M3_PPT_4 DDA.pptx
ssuser255bf1
 
PDF
Computer graphics notes
RAJKIYA ENGINEERING COLLEGE, BANDA
 
PPTX
Cg
Amit Pathak
 
DOCX
Computer graphics
Diksha Trivedi
 
PPT
Unit I-cg.ppt Introduction to Computer Graphics elements
RajeshSukte1
 
PPT
Introduction to Computer Graphics elements
RajeshSukte1
 
PPT
Introduction to Computer Graphics computer
RajeshSukte1
 
PPT
Bresenham circlesandpolygons
aa11bb11
 
PPT
Bresenham circles and polygons derication
Kumar
 
PPT
Lecture _Line Scan Conversion.ppt
GaganvirKaur
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
RajJain516913
 
computer graphics-C/C++-dancingdollcode
Bhavya Chawla
 
raster algorithm.pdf
Mattupallipardhu
 
Computer Graphics Unit 1
aravindangc
 
module 1.pdf
KimTaehyung188352
 
Computer Graphics Notes 2.pdf
AOUNHAIDER7
 
Computer Graphics involves technology to access. The Process transforms and p...
ErNandiniDharne
 
Computer graphics notes watermark
RAJKIYA ENGINEERING COLLEGE, BANDA
 
Unit 2
ypnrao
 
Line drawing algorithm and antialiasing techniques
Ankit Garg
 
4 CG_U1_M3_PPT_4 DDA.pptx
ssuser255bf1
 
Computer graphics notes
RAJKIYA ENGINEERING COLLEGE, BANDA
 
Computer graphics
Diksha Trivedi
 
Unit I-cg.ppt Introduction to Computer Graphics elements
RajeshSukte1
 
Introduction to Computer Graphics elements
RajeshSukte1
 
Introduction to Computer Graphics computer
RajeshSukte1
 
Bresenham circlesandpolygons
aa11bb11
 
Bresenham circles and polygons derication
Kumar
 
Lecture _Line Scan Conversion.ppt
GaganvirKaur
 
Ad

Cgm Lab Manual

  • 1. Lab Manual: Computer Graphics & Multimedia Department of Information Technology ORIENTAL INSTITUTE OF SCIENCE & TTEECCHHNNOOLLOOGGYY,, BBHHOOPPAALL DDEEPPAARRTTMMEENNTT OOFF IINNFFOORRMMAATTIIOONN TTEECCHHNNOOLLOOGGYY LLAABB MMAANNUUAALL NNaammee:: IIMMRRAANN KKHHAANN CCoouurrssee CCooddee:: IITT--660022 CCoouurrssee:: CCoommppuutteerr GGrraapphhiiccss && MMuullttiimmeeddiiaa SSeessssiioonn:: JJaann--JJuunn 22001144 PPrreeppaarreedd BByy DDrr.. ((LLtt..)) SS..KK.. SShhaarrmmaa PPrrooff.. IImmrraann KKhhaann HHeeaadd ((IITT)) 1
  • 2. Lab Manual: Computer Graphics & Multimedia Department of Information Technology TTaabbllee ooff CCoonntteennttss Sr. No. Particulars Page No. 1 Time Table 2 2 University Scheme 3 3 Syllabus 4 4 List of Books 4 5 List of Programs 5 6 Important Viva Questions 43 2
  • 3. Lab Manual: Computer Graphics & Multimedia Department of Information Technology TTiimmee TTaabbllee 3
  • 4. Lab Manual: Computer Graphics & Multimedia Department of Information Technology UUnniivveerrssiittyy SScchheemmee 4
  • 5. Lab Manual: Computer Graphics & Multimedia Department of Information Technology SSyyllllaabbuuss IT-602– Computer Graphics & Multimedia Unit I Introduction to Raster scan displays, Storage tube displays, refreshing, flickring, interlacing, colour monitors, display processors resolution, working principle of dot matirix, inkjet laser printers, working principles of keyboard, mouse scanner, digitizing camera, track ball , tablets and joysticks, graphical input techniques, positioning techniques, rubber band techniques, dragging etc. Unit II Scan conversion techniques, image representation, line drawing, simple DDA, Bresenham’s Algorithm, Circle drawing, general method, symmetric DDA, Bresenham’s Algorithm, curves, parametric function, Beizier Method, B-spline Method. Unit III 2D & 3D Co-ordinate system, Translation, Rotation, Scaling, Reflection Inverse transformation,Composite transformation, world coordinate system, screen coordinate system, parallel and perspective projection, Representation of 3D object on 2D screen. Point Clipping. Line Clipping Algorithms, Polygon Clipping algorithms, Introduction to Hidden Surface elimination, Basic illumination model, diffuse reflection, specular reflection, phong shading, Gourand shading ray tracing, color models like RGB, YIQ, CMY, HSV etc. Unit IV An Introduction – Multimedia applications – Multimedia System Architecture – Evolving technologies for Multimedia – Defining objects for Multimedia systems – Multimedia Data interface standards – Multimedia Databases.Multimedia components, Multimedia Hardware, SCSI, IDE, MCI, Multimedia -Tools,presentation tools, Authoring tools . Unit V Compression & Decompression – Multimedia Data & File Format standards :-TIFF, MIDI,JPEG,DIB, MPEG,RTF, – Multimedia I/O technologies - Digital voice and audio – Video image andanimation–Full motion video – Storage and retrievaltechnologies . 4. List of Books SN o TITLE AUTHOR PUBLISHER / EDITION YEAR 1 Computer Graphics C Version Donald Hearn and M.Pauline Baker Pearson Education 2003 2 Multimedia Systems and Design Prabat K Andleigh and Kiran Thakrar PHI Learning 2008 3 Multimedia making it work Tay Vaughan Tata McGraw Hill edition 2007 4 Computer Graphics Amarendra N Sinha & Arun D Udai McGraw Hill publication 2011 5 Fundamental of Computer Graphics and Multimedia Mukherjee PHI Learning 2008 LLiisstt ooff PPrrooggrraammss 5
  • 6. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Experi ment No. Aim Date of Submission Signature & Remarks 1. Write a program to implement DDA line drawing Algorithm. 2. Write a program to implement Bresenhams’ line drawing algorithm. 3. Write a program to implement Bresenhams’ circle drawing algorithm. 4. Write a program to draw an ellipse using Bresenhams’ algorithm. 5. Write a program to perform various transformations on line , square & rectangle. 6. Write a program to implement Cohen Sutherland line clipping algorithm. 7. Write a program to convert a color given in RGB space to it’s equivalent HSV color space 8. Write a program to implement JPEG compression scheme for still images. 9. Write a program to implement text compression algorithm. 10. To perform animation using any animation software. 11. To perform basic operations on image using any image editing software. Experiment-1 6
  • 7. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Required Software/ Software Tool OS:Linux Operating System or Windows Operating System C/C++ TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. Objective:-To implement DDA Algorithm for drawing a Line. Description: To DDA algorithm is an incremental scan conversion method. Here we perform calculations at each step using the results from the preceding step. The characteristic of the DDA algorithm is to take unit steps along one coordinate and compute the corresponding values along the other coordinate. The unit steps are always along the coordinate of greatest change, e.g. if dx = 10 and dy = 5, then we would take unit steps along x and compute the steps along y. In DDA we need to consider two cases; One is slope of the line less than or equal to one (|m| ≤1) and slope of the line greater than one (m| > 1). · When |m| ≤ 1 means y2-y1 = x2-x1 or y2-y1 <x2-x1.In both these cases we assume x to be themajor axis. Therefore we sample x axis at unit intervals and find the y values corresponding to each x value. We have the slope equation as Δ y = m Δ x y2-y1 = m (x2-x1) In general terms we can say that y i+1 - yi = m(x i+1 - xi ). But here Δ x = 1; therefore the equation reduces to y i+1= yi + m = yi + dy/dx. · When | m| > 1 means y2-y1> x2-x1 and therefore we assume y to be the major axis. Here we sample y axis at unit intervals and find the x values corresponding to each y value. We have the slope equation as Δ y = m Δ x y2-y1 = m (x2-x1) Algorithm : 1. Start. 2. Declare variables x,y,x1,y1,x2,y2,k,dx,dy,s,xi,yi and also declare gdriver=DETECT, mode. 3. Initialize the graphic mode with the path location in TurboC3 folder. 4. Input the two line end-points and store the left end-points in (x1,y1). 5. Load (x1, y1) into the frame buffer; that is, plot the first point. put x=x1,y=y1. 6. Calculate dx=x2-x1 and dy=y2-y1. 7. If abs (dx) > abs (dy), do s=abs(dx). 8. Otherwise s= abs(dy). 9. Then xi=dx/s and yi=dy/s. 10. Start from k=0 and continuing till k<s,the points will be i. X=x+xi. ii. Y=y+yi. 11. Plot pixels using putpixel at points (X,Y) in specified color. 12. Close Graph and stop. 7
  • 8. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Coding: Output:- 8
  • 9. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Experiment-2 9
  • 10. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Required Software/ Software Tool OS:Linux Operating System or Windows Operating System C/C++ TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. Objective:-To implement Bresenham ‘s Algorithm for drawing a Line. Description: Basic Concept: Move across the x axis in unit intervals and at each step choose between two different y coordinates For example, from position (2, 3) we have to choose between (3, 3) and (3, 4). We would like the point that is closer to the original line So we have to take decision to choose next point. So next pixels are selected based on the value of decision parameter p. The equations are given in below algorithm. Algorithm : 1. Input the two line end-points, storing the left end-point in (x0, y0) 2. Plot the point (x0, y0) 3. Calculate the constants Δx, Δy, 2Δy, and (2Δy - 2Δx) and get the first value for the decision parameter as: 4. At each xk along the line, starting at k = 0, perform the following test. If pk < 0, the next point to plot is (xk+1, yk ) and: Otherwise, the next point to plot is (xk+1, yk+1) and: 5.Repeat step 4 (Δx – 1) times NOTE: The algorithm and derivation above assumes slopes are less than 1. For other slopes we need to adjust the algorithm slightly Coding: 10
  • 11. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Output:- 11
  • 12. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Experiment-3 12
  • 13. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Required Software/ Software Tool OS:Linux Operating System or Windows Operating System C/C++ TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. Objective:-To implement Midpoint Circle drawing Algorithm for drawing a Circle. Description: Basic Concept: Circles have the property of being highly symmetrical, which is handy when it comes to drawing them on a display screen. · We know that there are 360 degrees in a circle. First we see that a circle is symmetrical about the axis, so only the first 180 degrees need to be calculated. · Next we see that it's also symmetrical about the y axis, so now we only need to calculate the first 90 degrees. · Finally we see that the circle is also symmetrical about the 45 degree diagonal axis, so we only need to calculate the first 45 degrees. · We only need to calculate the values on the border of the circle in the first octant. The other values may be determined by symmetry. Bresenham's circle algorithm calculates the locations of the pixels in the first 45 degrees. It assumes that the circle is centered on the origin. So for every pixel (x, y) it calculates, we draw a pixel in each of the eight octants of the circle. This is done till when the value of the y coordinate equals the x coordinate. The pixel positions for determining symmetry are given in the below algorithm. Algorithm : 1. Input radius r and circle centre (xc, yc), then set the coordinates for the first point on the circumference of a circle centred on the origin as: 2. Calculate the initial value of the decision parameter as: 3. Starting with k = 0 at each position xk, perform the following test. If pk < 0, the next point along the circle centred on (0, 0) is (xk+1, yk) and: 13
  • 14. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Otherwise the next point along the circle is (xk+1, yk-1) and: 4. Determine symmetry points in the other seven octants 5. Move each calculated pixel position (x, y) onto the circular path centred at (xc, yc) to plot the coordinate values: 6. Repeat steps 3 to 5 until x >= y Symmetric pixel positions: · putpixel(xc+x,yc-y,GREEN); //For pixel (x,y) · putpixel(xc+y,yc-x, GREEN); //For pixel (y,x) · putpixel(xc+y,yc+x, GREEN); //For pixel (y,-x) · putpixel(xc+x,yc+y, GREEN); //For pixel (x,-y) · putpixel(xc-x,yc+y, GREEN); //For pixel (-x,-y) · putpixel(xc-y,yc+x, GREEN); //For pixel (-y,-x) · putpixel(xc-y,yc-x, GREEN); //For pixel (-y,x) · putpixel(xc-x,yc-y, GREEN); //For pixel (-x,y) Coding: 14
  • 15. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Output: 15
  • 16. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Experiment-4 16
  • 17. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Required Software/ Software Tool OS:Linux Operating System or Windows Operating System C/C++ TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. Objective:- To implement Mid-Point Ellipse drawing Algorithm for drawing an ellipse. Description: Basic Concept: Midpoint ellipse algorithm is a method for drawing ellipses in computer graphics.This method is modified from Bresenham’s algorithm. The advantage of this modified method is that only addition operations are required in the program loops. This leads to simple and fast implementation in all processors. Let us consider one quarter of an ellipse. The curve is divided into two regions. In region I, the slope on the curve is greater than –1 while in region II less than –1. Algorithm : 1. Set RXSq = RX * RX 2. Set RYSq = RY * RY 3. Set X = 0 and Y = RY 4. Set PX = 0 and PY = 2 * RXSq * Y 5. Call Draw Elliplse(XC, YC, X, Y) 6. Set P = RYSq – (RXSq * RY) + (0.25 * RXSq) [Region 1] 7. Repeat While (PX < PY) 8. Set X = X + 1 9. PX = PX + 2 * RYSq 10. If (P < 0) Then 11. Set P = P + RYSq + PX 12. Else 13. Set Y = Y – 1 14. Set PY = PY – 2 * RXSq 15. Set P = P + RYSq + PX – PY 17
  • 18. Lab Manual: Computer Graphics & Multimedia Department of Information Technology [End of If] 16. Call Draw Elliplse(XC, YC, X, Y) [End of Step 7 While] 17. Set P = RYSq*(X + 0.5)2+RXSq*(Y – 1)2–RXSq*RYSq [Region 2] 18. Repeat While (Y > 0) 19. Set Y = Y – 1 20. Set PY = PY – 2 * RXSq 21. If (P > 0) Then 22. Set P = P + RXSq – PY 23. Else 24. Set X = X + 1 25. Set PX + 2 * RYSq 26. Set P = P + RXSq – PY + PX [End of If] 27. Call Draw Ellipse(XC, YC, X, Y) [End of Step 18 While] 28. Exit Coding: 18
  • 19. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Output: 19
  • 20. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Experiment-5 20
  • 21. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Required Software/ Software Tool OS:Linux Operating System or Windows Operating System C/C++ TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. Objective:-Write a C-program for performing the basic 2D transformations such as translation, Scaling, Rotation,shearing and reflection for a given 2D object. Description: Basic Concept: We have to perform 2D transformations on 2D objects. Here we perform transformations on a line segment.The 2D transformations are: 1. Translation 2. Scaling 3. Rotation 4. Reflection 5. Shear 1. Translation: Translation is defined as moving the object from one position to another position along straight line path. We can move the objects based on translation distances along x and y axis. tx denotes translation distance along x-axis and ty denotes translation distance along y axis. Translation Distance: It is nothing but by how much units we should shift the object from one location to another along x, y-axis. Consider (x,y) are old coordinates of a point. Then the new coordinates of that same point (x’,y’) can be obtained as follows: X’=x+tx Y’=y+ty We denote translation transformation as P. we express above equations in matrix form as: 2. Scaling: scaling refers to changing the size of the object either by increasing or decreasing. We will increase or decrease the size of the object based on scaling factors along x and y-axis. If (x, y) are old coordinates of object, then new coordinates of object after applying scaling transformation are obtained as: x’=x*sx y’=y*sy. sx and sy are scaling factors along x-axis and y-axis. 21
  • 22. Lab Manual: Computer Graphics & Multimedia Department of Information Technology 3. Rotation: A rotation repositions all points in an object along a circular path in the plane centered at the pivot point. We rotate an object by an angle theta. New coordinates after rotation depend on both x and y x’ = xcosθ -y sinθ y’ = xsinθ+ ycosθ or in matrix form: P' = R • P, R-rotation matrix. 4. Reflection: Reflection is nothing but producing mirror image of an object. Reflection can be done just by rotating the object about given axis of reflection with an angle of 180 degrees 5. Shear: 1. Shear is the translation along an axis by an amount that increases linearly with another axis (Y). Itproduces shape distortions as if objects were composed of layers that are caused to slide over each other. 2. Shear transformations are very useful in creating italic letters and slanted letters from regular letters. 3. Shear transformation changes the shape of the object to a slant position. 4. Shear transformation is of 2 types: a. X-shear: changing x-coordinate value and keeping y constant x’=x+shx*y y’=y b. Y-shear: changing y coordinates value and keeping x constant x’=x y’=y+shy*x shx and shy are shear factors along x and y-axis. 22
  • 23. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Coding: 23
  • 24. Lab Manual: Computer Graphics & Multimedia Department of Information Technology 24
  • 25. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Output: 25
  • 26. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Experiment-6 Required Software/ Software Tool OS:Linux Operating System or Windows Operating System C/C++ TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. Objective:-Write a program to implement Cohen Sutherland line clipping algorithm. Description: Basic Concept: This method speeds up the processing of line segments by performing initial tests that reduce the number of intersections that must be calculated. Every line endpoint is assigned to four digit, binary code called region code. Region code identifies the location of the pint relative to the boundaries of the clipping rectangle. Bit 1: left Bit 2: right Bit 3: below Bit 4: above Syntaxes & keywords: Drawpoly function is used to draw polygons i.e. triangle, rectangle, pentagon, hexagon etc. Declaration :- void drawpoly( int num, int *polypoints ); outtextxy function display text or string at a specified point(x,y) on the screen. Declaration :- void outtextxy(int x, int y, char *string); For a line segment with endpoints (x1,y1) and (x2,y2) and one or both endpoints outside the clipping rectangle, the parametric representation is, X = x1+u(x2-x1) Y= y1+u(y2-y1) Algorithm: Step 1: Start Step 2: Get the bottom-left coordinate of view port from the user. Step 3: Get the top-right coordinate of view port from the user. Step 4: Get the coordinates of 1st end point of line from the user. Step 5: Get the coordinates of 2nd endpoint of line from the user. Step 6: Print the region code of the first and second point. Step 7: If the points lie inside the view port, print ‖The line is totally visible. Step 8: If the starting point lies outside the view port, print ―The line is invisible. Step 9: If the starting point lies inside the view port and the ending point lies outside the view port, print ―The line is partially visible Step 10: Clip the line present outside the view port. Step 11: Draw the clipped line present inside the view port. Step 12: Stop 26
  • 27. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Coding: 27
  • 28. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Output: 28
  • 29. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Experiment-7 Required Software/ Software Tool OS:Linux Operating System or Windows Operating System C/C++ TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. Objective:-Write a program to convert a color given in RGB space to it’s equivalent HSV color space. Description: The Objective can be achieved by transformed the parameters of HSV to the RGB settings needed for the color monitor. Transformation from HSV parameters to RGB parameters by determining the inverse of the equations in rgbToHsv procedure. Syntaxes & keywords commands for achieving the objective void hsvtorgb(float h,float s,float v,float *r,float *g,float *b) void rgbtohsv(float r,float g,float b,float *h,float *s,float *v) void hsvtorgb(float h,float s,float v,float *r,float *g,float *b) Description about the parts of the program with description about the language constructs used for the same. Here passing pointers to (addresses of) r, g, and b - and the function is returning the r,g,b values. · hue in degrees (360.0) · saturation in percent (0.0 - 1.0) · value/brightness in percent (0.0-1.0) void rgbtohsv(float r,float g,float b,float *h,float *s,float *v) Here passing pointers to (addresses of) h, s, and v - and the function is returning the h,s,v values Algorithm: HSV to RGB 1. Read the H, S, V values in the range 0 to 1. 2. If the value of s is 0 then it is gray scale and the R, G, B becomes the value of V. 3. If the value of h is 1.0 then assign h=0 else h=h*6.0 and perform the following i= floor(h); f=h-i; aa=v*(1-s); bb=v*(1-s*f); cc=v*(1-s*(1f))); 4. Based on the i value assign v, aa, bb ,cc to RGB and display the RGB values. RGB to HSV 1. Read the R, G, B values. 2. Find the min,max value among the RGB values 3. Assign the maximum value to V. 4. S value is calculated by (max-min)/max. 5. H value is calculated by comparing R, G, and B values to max value. 6. Display the H, S and V values. 29
  • 30. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Coding: 30
  • 31. Lab Manual: Computer Graphics & Multimedia Department of Information Technology OutPut: 31
  • 32. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Experiment-8 Required Software/ Software Tool OS:Linux Operating System or Windows Operating System C/C++ TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. Objective:-Write a program to implement JPEG compression scheme for still images. Description: The basic idea behind this method of compression is to treat a digital image as an array of numbers i.e., a matrix. Each image consists of a fairly large number of little squares called pixels. Objective: The main Objective is to reduce irrelevance and redundancy of the image data in order to be able to store or transmit data in an efficient form. How it is being achieved? It can be achieved by using image compression techniques. Syntaxes & keywords commands for achieving the objectiv · import java.util.zip.*; · FileInputStream() · DeflaterOutputStream Description about the parts of the program with description about the language constructs used for the same. import java.util.zip.*; - Provides classes for reading and writing the standard ZIP and GZIP file formats. FileInputStream() - FileInputStream is meant for reading streams of raw bytes such as image data. For reading streams of characters, consider using FileReader. DeflaterOutputStream - This class implements an output stream filter for compressing data in the "deflate" compression format. Algorithm 1. File input stream class is used to access the input file 2. Read the content of the image file and assign to a variable 3. write the value to an object 4. Repeat the step 3 until end of file. 5. Print the size of the compressed image . 32
  • 33. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Coding: 33
  • 34. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Output: 34
  • 35. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Experiment-9 Required Software/ Software Tool OS:Linux Operating System or Windows Operating System C/C++ TOOLS/APPARATUS: Turbo C or gcc / gprof compiler in linux. Objective:-Write a program to implement text compression algorithm. Description: Run Length Encoding (RLE) is a simple and popular data compression algorithm. It is based on the idea to replace a long sequence of the same symbol by a shorter sequence and is a good introduction into the data compression field. For instance, text files with large runs of spaces or tabs may compress well with this algorithm. Objective: The main Objective is to compress the data without any loss using text compression algorithm. How it is being achieved? It can be achieved by replace a long sequence of the same symbol by a shorter sequence of a symbol. Syntaxes & keywords commands for achieving the objectiv · gets(str); used to get the string from the userFileInputStream() Algorithm: 1. Read the message. 2. Check the first character with the next character. 3. If it is same, then increment the count and check the next character. 4. Repeat the step 2 & 3 till reads the null character. 5. Display the encoded message 35
  • 36. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Coding: 36
  • 37. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Output: 37
  • 38. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Experiment-10 Required Software/ Software Tool OS: Windows Operating System TOOLS/APPARATUS: Adobe Flash Player. Objective: - To perform animation using any animation software. Description: Animation is anything that moves on your screen like a cartoon character. Time sequence of visual images on a scene. It can be achieved by using animation software like Swiss, flash Algorithm: Motion Tweening Step 1: Create an object in the first layer of first key frame. Step 2: Create the last key frame and move the object to it. Step 3: Right click on the first key frame and select create motion tween. Step 4: Play the picture. Shape Tweening Step 1: Create an object in the first layer of first key frame. Step 2: Create the last key frame. Step 3: In first key frame’s properties and select shape tween. Step 4: Change the shape of the object at the last frame. Step 5: Play the picture. Guide Layer Step 1: Create an object in the first layer of first key frame. Step 2: Create the last key frame and move the object to it. Step 3: Right click on the first key frame and select create motion tween. Step 4: Right click on the object’s layer select add motion guide. Step 5: In motion guide draw your guide line. Step 6: Play the picture. Masking Step 1: Create an object in the first layer of first key frame Step 2: Add new layer and draw the shape of the view. 38
  • 39. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Step 3: Add the motion guide to the view tool. Step 4: Right click on the second layer (view layer) and select mask. Step 5: Play the picture. Output Shape Tweening Motion Tweening 39
  • 40. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Guide Layer 40
  • 41. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Masking Experiment-11 Required Software/ Software Tool OS: Windows Operating System TOOLS/APPARATUS: Adobe Flash Player. Objective: - To perform basic operations on image using any image editing software. Description: Adobe Photoshop is a graphics editing program developed and published by Adobe Systems. Photoshop is a tool that helps design sequences for videos and films by removing the guesswork for film and video professionals. Procedure: The Brush Popup Palette Allow quick, convenient access to a range of standard, preset brushes. The Brushes Palette Provides access to a wide variety of options for controlling the appearance and characteristics of brush. The Pencil Tool Used to draw free form lines. These draws with the foreground color. 41
  • 42. Lab Manual: Computer Graphics & Multimedia Department of Information Technology The Gradient Tool Used to color pixels with the foreground color based on tolerance setting. The Paint Bucket Tool Used to color pixels with the foreground color on the tolerance setting. Cropping An Image Digital editors are used to crop images. Cropping creates a new image by selecting a desired rectangular portion from the image being cropped. The unwanted part of the image is discarded. Image cropping does not reduce the resolution of the area cropped. A primary reason for cropping is to improve the image composition in the new image. Removal of Unwanted Elements Most image editors can be used to remove unwanted branches, etc., using a "clone" tool. Image Orientation Image orientation (from left to right): original, -30° CCW rotation, and flipped. Sharpening And Softening Images Graphics programs can be used to both sharpen and blur images in a number of ways, such as unsharp masking or deconvolution. Editing · Open your project file and create a duplicate. · Crop the image using crop tool. · Change the image size using canvas technique. Back Ground Changing · Select the area to change the back ground using magic wand tool. · Select the back ground image for your image. · Move the shape of the back ground using marquee tool. · Using selection tool, move the back ground. Changing Color · Select the area using Lasso tool . · Go to image tab and adjustments and select the Hue / saturation option. · Change the color using RGB mode. Output 42
  • 43. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Results 43
  • 44. Lab Manual: Computer Graphics & Multimedia Department of Information Technology IImmppoorrttaanntt VViivvaa QQuueessttiioonnss 1. What is scan conversion? A major task of the display processor is digitizing a picture definition given in an application program into a set of pixel-intensity values for storage in the frame buffer. This digitization process is called scan conversion. 2. Write the properties of video display devices? Properties of video display devices are persistence, resolution, and aspect ratio. 3. What is rasterization? The process of determining the appropriate pixels for representing picture or graphics object is known as rasterization. 4. Define Computer graphics. Computer graphics remains one of the most existing and rapidly growing computer fields. Computer graphics may be defined as a pictorial representation or graphical representation of objects in a computer. 44
  • 45. Lab Manual: Computer Graphics & Multimedia Department of Information Technology 5. Name any four input devices. Four input devices are keyboard, mouse, image scanners, and trackball. 6. Write the two techniques for producing color displays with a CRT? Beam penetration method, shadow mask method 7. What is vertical retrace of the electron beam? In raster scan display, at the end of one frame, the electron beam returns to the left top corner of the screen to start the next frame, is called vertical retrace of the electron beam. 8. Short notes on video controller? Video controller is used to control the operation of the display device. A fixed area of the system is reserved for the frame buffer, and the video controller is given direct access to the frame buffer memory. 9. What is bitmap? Some system has only one bit per pixel; the frame buffer is often referred to as bitmap. 10. Differentiate plasma panel display and thin film electro luminescent display? In plasma panel display, the region between two glass plates is filled with neon gas. In thin film electro luminescent display, the region between two glasses plates are filled with phosphor, such as zinc sulphide doped with manganese. 11. What is resolution? The maximum number of points that can be displayed without overlap on a CRT is referred to as the resolution. 12. What is horizontal retrace of the electron beam? In raster scan display, the electron beam return to the left of the screen after refreshing each scan line, is called horizontal retrace of the electron beam. 13. What is filament? In the CRT, heat is applied to the cathode by directing a current through a coil of wire, is called filament. 14. What is pixmap? Some system has multiple bits per pixel, the frame buffer is often referred to as pixmap. 15. Write the types of clipping? Point clipping, line clipping, area clipping, text clipping and curve clipping. 16. What is meant by scan code? When a key is pressed on the keyboard, the keyboard controller places a code carry to the key pressed into a part of the memory called as the keyboard buffer. This code is called as the scan code. 17. List out the merits and demerits of Penetration techniques? The merits and demerits of the Penetration techniques are as follows 45
  • 46. Lab Manual: Computer Graphics & Multimedia Department of Information Technology • It is an inexpensive technique • It has only four colors • The quality of the picture is not good when it is compared to other techniques • It can display color scans in monitors • Poor limitation etc. 18. List out the merits and demerits of DVST? The merits and demerits of direct view storage tubes [DVST] are as follows • It has a flat screen • Refreshing of screen is not required • Selective or part erasing of screen is not possible • It has poor contrast Performance is inferior to the refresh CRT. 19. What do you mean by emissive and non-emissive displays? The emissive display converts electrical energy into light energy. The plasma panels, thin film electro-luminescent displays are the examples. The Non-emissive are optical effects to convert the sunlight or light from any other source to graphic form. Liquid crystal display is an example. 20. List out the merits and demerits of Plasma panel display? Merits • Refreshing is not required • Produce a very steady image free of Flicker • Less bulky than a CRT. Demerits • Poor resolution of up to 60 d.p.i • It requires complex addressing and wiring • It is costlier than CRT. 21. What is persistence? The time it takes the emitted light from the screen to decay one tenth of its original intensity is called as persistence. 22. What is Aspect ratio? The ratio of vertical points to the horizontal points necessary to produce length of lines in both directions of the screen is called the Aspect ratio. Usually the aspect ratio is ¾. 23. What is the difference between impact and non-impact printers? Impact printer press formed character faces against an inked ribbon on to the paper. A line printer and dot-matrix printer are examples. Non-impact printer and plotters use Laser techniques, inkjet sprays, Xerographic process, electrostatic methods and electro thermal methods to get images onto the papers. Examples are: Inkjet/Laser printers. 24. Define pixel? Pixel is shortened forms of picture element. Each screen point is referred to as pixel or pel. 25. What is frame buffer? Picture definition is stored in a memory area called frame buffer or refresh buffer. 46
  • 47. Lab Manual: Computer Graphics & Multimedia Department of Information Technology 26. Where the video controller is used? A special purpose processor, which is used to control the operation of the display device, is known as video controller or display controller. 27. What is run length encoding? Run length encoding is a compression technique used to store the intensity values in the frame buffer, which stores each scan line as a set of integer pairs.One number each pair indicates an intensity value, and second number specifies the number of adjacent pixels on the scan line that are to have that intensity value. 28. What is point in the computer graphics system? The point is a most basic graphical element & is completely defined by a pair of user coordinates (x, y). 29. Write short notes on lines? A line is of infinite extent can be defined by an angle of slope q and one point on the line P=P(x,y). This can also be defined as y=mx+C where C is the Yintercept. 30. Define Circle? Circle is defined by its center xc, yc and its radius in user coordinate units.The equation of the circle is (x-xc) + (y-yc) = r2. 31. What are the various attributes of a line? The line type, width and color are the attributes of the line. The line type include solid line, dashed lines, and dotted lines. 32. What is antialiasing? The process of adjusting intensities of the pixels along the line to minimize the effect of aliasing is called antialiasing. 33. What is Transformation? Transformation is the process of introducing changes in the shape size and orientation of the object using scaling rotation reflection shearing & translation etc. 34. What is translation? Translation is the process of changing the position of an object in a straight-line path from one coordinate location to another. Every point (x , y) in the object must undergo a displacement to (x|,y|). the transformation is: x| = x + tx ; y| = y+ty 35. What is rotation? A 2-D rotation is done by repositioning the coordinates along a circular path, in the x-y plane by making an angle with the axes. The transformation is given by: X| = r cos (q + f) and Y| = r sin (q + f). 36. What is scaling? 47
  • 48. Lab Manual: Computer Graphics & Multimedia Department of Information Technology A 2-D rotation is done by repositioning the coordinates along a circular path, in the x-y plane by making an angle with the axes. The transformation is given by: X| = r cos (q + f) and Y| = r sin (q + f). 37. What is shearing? The shearing transformation actually slants the object along the X direction or the Y direction as required. ie; this transformation slants the shape of an object along a required plane. 38. What is reflection? The reflection is actually the transformation that produces a mirror image of an object. For this use some angles and lines of reflection. 39. What are the two classifications of shear transformation? X shear, y shear. 40. A point (4,3) is rotated counterclockwise by an angle of 45°. Find the rotation matrix and the resultant point. 41. Name any three font editing tools. ResEdit, FONTographer, 42. Differentiate serif and sans serif fonts. Give one example Serif fonts has a little decoration at the end of the letter, but serif font has not. Times, new century schoolbook is the examples of serif fonts. Arial, potima are examples for sans serif fonts. 43. Distinguish between window port & view port? A portion of a picture that is to be displayed by a window is known as window port. The display area of the part selected or the form in which the selected part is viewed is known as view port. 44. Define clipping? Clipping is the method of cutting a graphics display to neatly fit a predefined graphics region or the view port 45. What is the need of homogeneous coordinates? To perform more than one transformation at a time, use homogeneous coordinates or matrixes. They reduce unwanted calculations intermediate steps saves time and memory and produce a sequence of transformations. 46. Distinguish between uniform scaling and differential scaling? When the scaling factors sx and sy are assigned to the same value, a uniform scaling is produced that maintains relative object proportions. Unequal values for sx and sy result in a differential scaling that is often used in design application. 47. What is fixed point scaling? The location of a scaled object can be controlled by a position called the fixed point that is to remain unchanged after the scaling transformation. 48. What is Bezier Basis Function? 48
  • 49. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Bezier Basis functions are a set of polynomials, which can be used instead of the primitive polynomial basis, and have some useful properties for interactive curve design. 49. What is surface patch A single surface element can be defined as the surface traced out as two parameters (u, v) take all possible values between 0 and 1 in a two-parameter representation. Such a single surface element is known as a surface patch. 50. Define B-Spline curve? A B-Spline curve is a set of piecewise(usually cubic) polynomial segments that pass close to a set of control points. However the curve does not pass through these control points, it only passes close to them. 51. What is a spline? To produce a smooth curve through a designed set of points, a flexible strip called spline is used. Such a spline curve can be mathematically described with a piecewise cubic polynomial function whose first and second derivatives are continuous across various curve section. 52. What are the different ways of specifying spline curve? • Using a set of boundary conditions that are imposed on the spline. • Using the state matrix that characteristics the spline • Using a set of blending functions that calculate the positions along the curve path by specifying combination of geometric constraints on the curve 53. What are the important properties of Bezier Curve? • It needs only four control points • It always passes through the first and last control points • The curve lies entirely within the convex half formed by four control points. 54. Define Projection? The process of displaying 3D into a 2D display unit is known as projection. The projection transforms 3D objects into a 2D projection plane 55. What are the steps involved in 3D transformation? • Modeling Transformation • Viewing Transformation • Projection Transformation • Workstation Transformation 56. What do you mean by view plane? A view plane is nothing but the film plane in camera which is positioned and oriented for a particular shot of the scene. 57. Define projection? The process of converting the description of objects from world coordinates to viewing coordinates is known as projection 58. What you mean by parallel projection? 49
  • 50. Lab Manual: Computer Graphics & Multimedia Department of Information Technology Parallel projection is one in which z coordinates is discarded and parallel lines from each vertex on the object are extended until they intersect the view plane. 59. What do you mean by Perspective projection? Perspective projection is one in which the lines of projection are not parallel. Instead, they all converge at a single point called the center of projection. 60. What is Projection reference point? In Perspective projection, the lines of projection are not parallel. Instead, they all converge at a single point called Projection reference point. 61. Define computer graphics animation? Computer graphics animation is the use of computer graphics equipment where the graphics output presentation dynamically changes in real time. This is often also called real time animation. 62. What is tweening? It is the process, which is applicable to animation objects defined by a sequence of points, and that change shape from frame to frame. 63. Define frame? One of the shape photographs that a film or video is made of is known as frame. 64. What is key frame? One of the shape photographs that a film or video is made of the shape of an object is known initially and for a small no of other frames called key frame 65. Define Multimedia Multimedia is the use of the computer to present and combine text, graphics, audio and video with links and tools that lets the user to navigate, interact, create and communicate. 66. What is multimedia PC: A multimedia PC is a computer that has a CD-ROM or DVD drive and supports 8-bit and 16- bit waveform audio recording and playback, MIDI sound synthesis, and MPEG movie watching, with a central processor fast enough and a RAM large enough to enable the user to play and interact with these media in real time, and with a hard disk large enough to store multimedia works that the user can create. 67. Where to use multimedia? Multimedia improves information relation. Multimedia applications include the following: • Business • Schools • Home • Public place 68. List out the benefits of multimedia Benefits of multimedia are · Training · Sales · Communications · Medicines 50
  • 51. Lab Manual: Computer Graphics & Multimedia Department of Information Technology 69. What is hypermedia? A set of documents in which a given document can contain text, graphics video and audio clips as well as embedded references to other documents world wide web pages are hypermedia documents. 70. What is hypertext? Hyper text is an application of indexing text to provide a rapid search of specific text strings in one or more documents. Hypertext is an integral part of hypermedia documents. In multimedia applications, a hypermedia documents is the basic complex object of which text is a sub-object. Other sub-objects in the basic object include images, sound, and full-motion video. 71. List out the building blocks of multimedia. · Text · Image · Sound · Animation, Video 72. What are the main functions of a multimedia development system? Multimedia development system must perform main three functions as follows: · Input data · Development · Data output Data input from sources such as cameras or musical instruments, application development, and data output to some delivery medium such as a videodisk or CD-ROM. 73. Define Typeface Typeface is measured in point sizes, where one point is approximately 1/72 of an inch. It is a measure of the height of the metal blocks containing letters. 74. Define the following: (i) X-height (ii) Set (iii) Kerning (i.)X-height: The X-height is the measurement of the height of the character X, in other words of the middle bit without any ascender or descender. (ii) Set: The width of the letters is called the set and is fixed relative to the point-size. (iii) Kerning: The spaces between letters in one world (tracking) can be adjusted in a process called kerning. 75. Define the following respective to sound: (i) Waveform (ii) Frequency (iii) Amplitude i) Waveform Sound is produced by the vibration of matter. During the vibration pressure variation are created in the air surrounding it. The pattern of the oscillation is called a waveform. (ii) Frequency The frequency of the sound is the reciprocal value of the period. It represents the number of period s in a second and it is measured in Hertz (Hz) or cycles per second. 51
  • 52. Lab Manual: Computer Graphics & Multimedia Department of Information Technology (iii) Amplitude A sound also has amplitude. The amplitude of a sound is a measure of the displacement of the air pressure wave from its, or quiescent state. 76. Define quantization (or) resolution? The resolution (or) quantization of a sample value depends on the number of bits used in measuring the height of the waveform. An 8-bit quantization yields 256 possible values, 16-bit CD-qudra quantization results in over 65536 values. 77. What are the types of sound objects that can be used in multimedia production? There are four types of sound objects that can be used in multimedia production: · Waveform audio · MIDI sound tracks · Compact disc (CD) audio · MP3 files 78. What is MIDI? Musical Instrument Digital Interface (MIDI) is the interface between electronic musical instruments and computers is a small piece of equipment that plugs directly into the computer’s serial port and allows the transmission of music signal. MIDI is considered to be the most compact interface that allows full-scale output. 79. List out the components of MIDI interface. A MIDI interface has two different components: · Hardware · Data format Hardware connects the equipment. It specifies the physical connection between musical instruments, stimulate that a port MIDI port is built into an instrument, specifies a MIDI cable and deals with electronic signals t that are sent over the cable. Data format encodes the information traveling through the hardware MIDI data format includes an instrument –connected data format. The encoding includes, besides the instrument specification, the notion of the beginning and end of a note, basic frequency and sound volume; MIDI data allow an encoding of about 10 octaves, which corresponds to 128 notes. 80. Define the term flicker in video. A periodic fluctuation of brightness perception is called flicker effect. 81. Define Random scan/Raster scan displays? Random scan is a method in which the display is made by the electronic beam which is directed only to the points or part of the screen where the picture is to be drawn. The Raster scan system is a scanning technique in which the electrons sweep from top to bottom and from left to right. The intensity is turned on or off to light and unlight the pixel. 82. What is an MPC? The MPC computer is not a hardware unit but rather a standard that includes minimum specifications to turn Intel microprocessor-based computers into multimedia computers. 83. List all the MPC standards 52
  • 53. Lab Manual: Computer Graphics & Multimedia Department of Information Technology There are currently three MPC standards as follows · MPC Level 1 · MPC Level 2 · MPC Level 3 The standards apply not only to desktop computers but also to increasingly more powerful multimedia laptops. 84. What is configuration of MPC level 1 standards? The MPC level 1 minimum standard workstation consisted of a 16MHz 386SX microprocessor, atleast 2MB of RAM, a 30MB Hard disk, a CD-ROM drive, VGA video (16 colors), an 8-bit audio board, speakers and/or headphones, and Microsoft windows software with the Multimedia Extensions package. 85. Write the configuration of MPC level 2 standards. MPC level 2 minimum standard consisted of a 25MHz 486SX microprocessor with atleast 4MB of RAM, a 3.5-inch high density, a 160 MB or larger hard disk drive, and a CD-ROM drive capable of sustained 300k per second transfer rate with CD-DA outputs and volume control, 16-bit sound capability with microphone input, and a color monitor with display resolution of atleast 640X 480 with 65,536(64k) colors. 86. List out the input devices of multimedia. Input devices for a multimedia system are as follows: · Keyboards · Mouse · Trackball · Touch screen · Magnetic card Encoders and Readers · Graphics Tablets · Scanners · Optical Character Recognition (OCR) devices · Voice Recognition Systems · Digital cameras 87. What is a Video disk? Video disk serves as the output of motion pictures and audio. The data are stored in an analog-coded format on the disk. The reproduced data meet the highest quality requirements. Video disk has a diameter of approximately 30cm and stores approximately 2.6 Giga bytes. 88. What is synchronization? Integration of the different media is given through a close relation between information units. This is called synchronization. 89. What is meant by Multimedia User Interface? Multimedia user interface is a computer interface that communicates with users multiple media. 90. Define the following terms: (i) Compression Ratio (ii) Image Quality 53
  • 54. Lab Manual: Computer Graphics & Multimedia Department of Information Technology (i) Compression Ratio: The Compression Ratio represents the size of the original image divided by the size of the compressed image. (ii) Image Quality: Compression ratio typically affects picture quality, the higher the compression ratio, the lower the quality of the decompressed image. 91. What are the higher levels of multimedia communication system (MCS)? The higher layers of the multimedia communication system are divided into two architectural subsystems: • Application subsystem • Transport subsystem. 92. Define collaborative computing environment? The recent infrastructure of networked workstations and pcs, and the availability of audio and video at these end points, makes it easier to people to cooperate and bridge space and time. In this way, network connectivity and endpoint integration of multimedia provide users with a collaborative computing environment. It is generally known as computer supported cooperative work (CSCW). 93. List out the tools for collaborative computing The tools used for collaborative computing are as follows: • Electronic mail • Bulletin boards(e.g. Usenet news) • Screen sharing tools(e.g. show me from sunsoft) • Text-based conferencing systems (e.g. Internet relay chat, CompuServe, America online). • Telephone conference systems. • Conference rooms(e.g. video window from Bellcore) • Video conference systems(e.g.,Mbone tools) 54