Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 30

DEPARTMENT OF COMPUTER SCIENCE AND

ENGINNERING

ODD SEM (VII/IV)


CS2405-COMPUTER GRAPHICS
LAB MANUAL

Prepared by:
SATHISHKUMAR.N
MAHALAKSHMI.S
Asst Prof/ CSE

LIST OF EXPERIMENT
COMPUTER GRAPHICS LABORATORY (CS2405)
1. To implement Bresenhams algorithms for line, circle and ellipse drawing
2. To implement the basic attributes of Line, Circle and Ellipse
3. To perform 2D Transformations such as translation, rotation, scaling,
reflection and shearing.
4. To perform composite 2D Transformations
5. To implement Cohen-Sutherland 2D clipping and window-viewport
mapping
6. To implement Sutherland Hodgeman Polygon clipping algorithm.
7. To perform 3D Transformations such as translation, rotation and scaling.
8. To perform composite 3D Transformations
9. To draw three Dimensional objects and scenes.
10. To generate fractal images

CONTENT BEYOND SYLLABUS


1.Develop any Moving Object(5 min) in 2D or 3D Using blender
Software or any other Software.

BASIC GRAPHICS FUNCTION


1) initgraph()
initgraph() function initializes the graphics mode and clears the
screen.
Declaration:
void far initgraph(int far *driver, int far *mode, char far *path)
2) detectgraph()
Detectgraph function determines the graphics hardware in the
system, if the function finds a graphics adapter then it returns the highest
graphics mode that the adapter supports.
Declaration:
void far detectgraph(int far *driver, int far *mode)
Integer that specifies the graphics driver to be used. You can give
graphdriver a value using a constant of the graphics_drivers enumeration
type.
3) closegraph()
closegraph() function switches back the screen from graphcs mode to
text mode. It clears the screen also.
A graphics program should have a closegraph function at the end of
graphics. Otherwise DOS screen will not go to text mode after running the
program.
4)getpixel()
getpixel function returns the color of pixel present at location(x, y).
Declaration :int getpixel(int x, int y);
3

5) putpixel()
putpixel function plots a pixel at location (x, y) of specified color.
Declaration :void putpixel(int x, int y, int color);
For example if we want to draw a GREEN color pixel at (35, 45)
then we will write putpixel(35, 35, GREEN); in our c program,
putpixel function can be used to draw circles, lines and ellipses using
various algorithms.
6) line()
line function is used to draw a line from a point(x1,y1) to
point(x2,y2) i.e. (x1,y1) and (x2,y2) are end points of the line.
Declaration :void line(int x1, int y1, int x2, int y2);
7) lineto()
lineto function draws a line from current position(CP) to the
point(x,y), you can get current position using getx and gety function.
8) circle()
circle function is used to draw a circle with center (x,y) and third
parameter specifies the radius of the circle.

Declaration :void circle(int x, int y, int radius);


9)ellipse()
Ellipse is used to draw an ellipse (x,y) are coordinates of center of the
ellipse, stangle is the starting angle, end angle is the ending angle, and fifth
and sixth parameters specifies the X and Y radius of the ellipse. To draw a
complete ellipse strangles and end angle should be 0 and 360 respectively.
Declaration :void ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius);
10) drawpoly()
drawpoly function is used to draw polygons i.e. triangle, rectangle,
pentagon, hexagon etc.
Declaration :void drawpoly( int num, int *polypoints );
num indicates (n+1) number of points where n is the number of
vertices in a polygon, polypoints points to a sequence of (n*2) integers .
Each pair of integers gives x and y coordinates of a point on the polygon.
We specify (n+1) points as first point coordinates should be equal to (n+1) th
to draw a complete figure.
To understand more clearly we will draw a triangle using drawpoly,
consider for example the array :int points[] = { 320, 150, 420, 300, 250, 300, 320, 150};

points array contains coordinates of triangle which are (320, 150),


(420, 300) and (250, 300). Note that last point(320, 150) in array is same as
first.
11) outtext ()
outtext function displays text at current position.
Declaration :void outtext(char *string);
12) outtextxy ()

outtextxy function display text or string at a specified point(x,y) on


the screen.
Declaration :void outtextxy(int x, int y, char *string);
x, y are coordinates of the point and third argument contains the
address of string to be displayed.
13)rectangle()
Rectangle function is used to draw a rectangle. Coordinates of left
top and right bottom corner are required to draw the rectangle. left specifies
the X-coordinate of top left corner, top specifies the Y-coordinate of top left
corner, right specifies the X-coordinate of right bottom corner, bottom
specifies the Y-coordinate of right bottom corner.

Declaration :void rectangle(int left, int top, int right, int bottom);
14) floodfill()
floodfill function is used to fill an enclosed area. Current fill pattern
and fill color is used to fill the area.(x, y) is any point on the screen if (x,y)
lies inside the area then inside will be filled otherwise outside will be
filled,border specifies the color of boundary of area.
Declaration :void floodfill(int x, int y, int border);
15)fillpoly()
f illpoly function draws and fills a polygon. It require same
arguments as drawpoly.
Declaration :void drawpoly( int num, int *polypoints );
16)fillellipse()
f illellipse function draws and fills a polygon.
Declaration:void fillellipse(int x, int y, int xradius, int yradius);
x and y are coordinates of center of the ellipse, xradius and yradius
are x and y radius of ellipse respectively.

EX.NO:1.1
BRESENHAMS LINE DRAWING
Aim:
To implement Bresenhams line drawing Algorithm for drawing lines.
Functions used:

line ()

The function line () is used to draw a line from(x1,y1)to (x2,y2)


Syntax:
line (x1,y1,x2,y2)

initgraph ().

This function takes thee arguments and they are


8

i).the video driver to be used (gd).


ii).the graphics mode (gm).
iii).the path name.
Syntax:
initgraph (gd,gm,path)
Algorithm:
Step 1: Start
Step 2: Get the values of the end points as(x1, y1) &(x2, y2)
Step 3: Assign x=x1, y=y1;
Step 4: Compute dx=x2-x1
Step 5: Compute dy=y2-y1
Step 6: Assign sx=x2-x1, sy=y2-y1
Step 7: If dy>dx then interchange the values of dx and dy and assign exch=1
Step 8: Compute p=2xdy-dx
Step 9: Put a pixel on(x,y)
Step 10: If exch=1, y=sy else x=x+sx
Step 11: If p>0 and exch =1, x=x+sx else y=y+sy, p=p-2xdx
Step 12: Compute p=p+2xdy
Step 13: Do steps (9) t0 (12) for dx times
Step 14: Stop

EX.NO:1.2
BRESENHAMS CIRCLE DRAWING
Aim:
To write a program to draw a circle using Bresenhams circle drawing
Algorithm.
Functions used:

Circle()

The function circle () is used to draw a circle using(x,y) as centre point.


Syntax:
circle (x,y,radius)

initgraph ().

This function takes thee arguments and they are


i).the video driver to be used (gd).
ii).the graphics mode (gm).
iii).the path name.

Syntax:
Initgraph (gd,gm,path)

Putpixel ()

The function putpixel() is used to place a pixel at particular coordinate


Syntax:
Putpixel(x,y,color)
Algorithm:
Step 1: Start
Step 2: Get the center point as (xc,yc),get the radius as r.
Step 3: Assign y=r,x=0
Step 4: Calculate p=3-2r
Step 5: If p<0,p=p+4x+6 else p=p+10+4(x-y) and y=y-1
Step 6: Increment x by 1
Step 7: Do steps (9) to (16)
Step 8: Repeat steps (5) to (9) until x<=y
Step 9: Put a pixel on (xc+x,yc+y,15);
Step 10: Put a pixel on (xc+x,yc-y,15);
Step 11: Put a pixel on (xc-x,yc+y,15);
Step 12: Put a pixel on (xc-x, yc-y, 15);
Step 13: Put a pixel on (xc+y,yc+x,15);
Step14: Put a pixel on (xc+y, yc-x, 15);
Step 15: Put a pixel on (xc-y, yc+x, 15);
Step 16: Put a pixel on (xc-y, yc-x, 15);
Step 17: Stop.

10

EX.NO:1.3
BRESENHAMS ELLIPSE DRAWING
Aim:
To write a program to draw a ellipse using Bresenhams ellipse drawing
Algorithm.
Functions used:

initgraph().

This function takes thee arguments and they are


i).the video driver to be used (gd).
ii).the graphics mode (gm).
iii).the path name.
Syntax:
Initgraph(gd,gm,path)

Putpixel ()

The function putpixel() is used to place a pixel at particular coordinate


Syntax:
Putpixel(x,y,color)
Algorithm:

11

Step 1: Start
Step 2: Get the center point as(x1, y1)
Step 3: Get the length of semi-major, semi-minor axes as r1 & r2
Step 4: Calculate t=pi/180
Step 5: Initialise i=0;
Step 6: Compute d=i*t
Step 7: Compute x=x1+y1*sin(d), y=y1+r2*cos(d).
Step 8: Put a pixel on(x,y)
Step 9: Increment I by 1
Step 10: Repeat steps(6) to (9) until i<360
Step 11: Stop

EX.NO:2
IMPLEMENTATION OF LINE,CIRCLE & ELLIPSE
ATTRIBUTES
Aim:
To implement the basic attributes of Line, Circle and Ellipse
Procedure:
Implementation of Line,Circle & Ellipse attributes
(x,y) are the interior points, boundary is the boundary color and fill_color is the
color to be filled. Following is a recursive method for boundary fill.
1. present_color = getcolor() // a function which returns the current color of (x,y)
2. if present_color <> boundary and if present_color <> fill_color then repeat steps
3-7
3. set_pixel (x,y, fill_color)
4. call the algorithm recursively for points (x + 1, y)
5. call the algorithm recursively for points (x 1,y)
6. call the algorithm recursively for points (x,y + 1)
7. call the algorithm recursively for points (x,y - 1)
8. stop
Algorithm:
Line,Circle & Ellipse attributes
Step 1. Input n, number of vertices of polygon
Step 2. input x and y coordinated of all vertices i array x[n] and y[n]
Step 3. find ymin and yma x

12

Step 4. Store the initail x values(x1) y values y1 and y2 for two endpoints and x
increment Dx from
scan line to scan line for each edge in the array edges [n] [4] while doing this
check that y1 >
y2 , if not interchange y1 and y2 and corresponding x1 and x2 so that for each
edge , y1
represents its maximum y coordinate and y2 represents it minimum y
coordiante
Step 5. Sort the rows of array , edges [n] [4] in descending order of y1 ,descending
order of y2 and
ascending order of
Step 6. Set y = yma x
Step 7. Find the active edges and update active edge list:if( y > y2 and y<= y1 ) then
edge is
activeOtherwise edge is not active
Step 8. Compute the x intersects for all active edges for current y values [ initially
x-intersect is and x
intersects for successive y values can be given asxi+1 = x i + Dx Where Dx = 1/m and m= y2 y1 / x2 - x1 i.e slope of a line segment
Step 9. VertexxIf x intersects is vertex i.e. X-intersect = x1 and y = y1 then apply
vertex test to check
whether to consider one intersect or two intersects. Store all x-intersect in the xintersect [ ]
array
Step 10. Store x-intersect [ ] array in the ascending order
Step 11. Extract pairs of intersects from the sorted x-intersect [ ] array
Step 12. Pass pair of x values to line drawing routine to draw corresponding line
segments

13

EX.NO:3
2D TRANSFORMATION
Aim:
To perform the 2D transformation such as translation, rotation, scaling,
shearing and reflection.
Functions Used:
Line()
The function line() is used to draw a line from(x1,y1)to (x2,y2)
Syntax:
line (x1,y1,x2,y2)
initgraph().
This function takes thee arguments and they are
i).the video driver to be used (gd).
ii).the graphics mode (gm).
iii).the path name.
Syntax:
Initgraph(gd,gm,path)
Algorithm:
Step1. Declare the variables xa,ya,xa1,ya1 of array type.
Step2.Declare the variables gd,gm,n,i,op,tx,ty,xf,yf,rx,ry.
Step3. Initialise the graphics function.
Step4. Input the number of points.
Step5. Input the value of co-ordinate according to number of points.
Step6. Using switch statement selects the option to perform
translation, rotation, scaling, reflection and shearing.
Step7. Translation:
a).input the translation vector
b).add the translation vectors with the coordinates
xa1[i]=xa[i]=tx, ya1[i]=ya[i]=ty,
c).using the function line,display the object before and after translation.
Step8. Rotation:
a). input the rotation angle
b). using formula theta=(theta*3.14)/180
c).input the value of reference point
d). calculate new coordinate point using formula
xa1[i]=xf+(xa[i]-xf)*cos(theta)-(ya[i]-yf)*sin(theta),
ya1[i]=yf+(xa[i]-xf)*sin(theta)-(ya[i]-yf)*cos(theta),

14

e). using the function line,display the object before and after rotation.
Step9. Scaling:
a).input the scaling factor and reference point
b).calculate new coordinate point using formula
xa1[i]=(xa[i]*sx+rx*(1-sx),
ya1 [i] = (ya[i]*sy+ry*(1-sy)
c). using the function line, display the object before and after scaling.
Step10. Shearing:
a).input the shearing value and reference point.
b). input the shear direction x or y
i).if direction x
xa1[i]=xa[i]+shx*(ya[i]-yref)
ii).otherwise
ya1[i]=ya[i]+shy*(xa[i]-xref)
iii). using the function line, display the object before and after shearing.
Step11. Reflection:
a).display the object before reflection using the function line
b). display the object after reflection using the function line
Step12. Stop.

EX.NO:4
2D COMPOSITE TRANSFORMATION
15

Aim:
To perform the 2D composite transformation such as translation, rotation,
scaling, shearing and reflection.

FUNCTIONS USED:
Line()
The function line() is used to draw a line from(x1,y1)to (x2,y2)
Syntax:
line (x1,y1,x2,y2)
initgraph()
This function takes thee arguments and they are
i).the video driver to be used (gd).
ii).the graphics mode (gm).
iii).the path name.
Syntax:
Initgraph(gd,gm,path)
Algorithm:
Step 1. Additivity of successive translations
We want to translate a point P to P by T(dx1, dy1) and then to P by
another T(dx2, dy2)
On the other hand, we can define T21= T(dx1, dy1) T(dx2, dy2) first, then
apply T21 to P:
where
T21 = T ( d x 2 , d y 2 )T (d x1 , d y1 )
1 0 d x 2 1 0 d x1
= 0 1 d y 2 0 1 d y1
0 0 1 0 0 1

Step 2. Multiplicativity of successive scaling


P ' ' = S ( s x 2 , s y 2 )[ S ( s x1 , s y1 ) P ]
=[ S ( s x 2 , s y 2 ) S ( s x1 , s y1 )]P
= S 21 P

16

1 0 d x1 + d x 2
= 0 1 d y1 + d y 2
0 0
1

where
S 21 = S ( s x 2 , s y 2 ) S ( s x1 , s y1 )
s x 2
= 0
0

0
sy2
0

s x 2 * s x1
= 0
0

0 s x1
0 0
1 0

0
s y1

0
0
1

s y 2 * s y1
0

0
0
1

Step 3. Additivity of successive rotations


P ' ' = R (2 )[ R (1 ) P ]
=[ R (2 ) R (1 )]P
= R21 P

where

R21 = R (2 ) R (1 )
cos 2
= sin 2
0

sin 2
cos 2
0

cos(2 + 1 )
= sin(2 + 1 )

0 cos 1
0 sin 1
1 0

sin(2 + 1 )
cos(2 + 1 )
0

sin 1
cos 1
0

0
0
1

0
0
1

Step 4. Stop.

EX.NO:5
COHEN-SUTHERLAND 2D LINE CLIPPING AND WINDOWING
Aim:
To implement Cohen-Sutherland 2D line clipping and windowing algorithm.
Functions used:

17

Line()
The function line() is used to draw a line from(x1,y1)to (x2,y2)
Syntax:
line (x1,y1,x2,y2)
initgraph().
This function takes thee arguments and they are
i).the video driver to be used (gd).
ii).the graphics mode (gm).
iii).the path name.
Syntax:
Initgraph(gd,gm,path)
Setcolor().
This function changes the drawing colour.
Syntax:
Setcolor(value of the color)
Settextstyle().
The function settextstyle() is used to change the style of the text.
Syntax:
Settextstyle(font,direction,charsize)
Where font is the constant value or the font filename, direction is the
number either 0 or 1, which makes the output to display in horizontal, or in
vertical direction, charsize is the character size or magnification factor and it
varies from 1 to 10.
Outtext().
This function display a text message on upper left of the screen
Syntax:
Outtext(message);

Algorithm:
For each line segment
Step 1. compute clip codes
Step 2. if both are 0 0 0 0
accept line segment
else if c1 & c2 != 0
discard line segment
else /* c1 & c2 = 0 */

18

clip against left


clip against right
clip against bottom
clip against top
if anything remains accept clipped segment.
Step 3.Stop
Windowing:
Step 1. If C1||C2 = 0000, the line segment is inside the window; display.
Step 2.If C1jjC2 = 0000, the line segment is inside the window; display.
Step 3. If C1&&C2 != 0000, the line segment is outside the window; discard.
Step 4.If neither 1) nor 2), the line segment is subdivided into two shorter
segments by one (extended) boundary of the window which crosses the line, and
for each of the resulting segments, repeat 1) and 2)
Step 5.Stop.

EX.NO:6
SUTHERLAND HODGEMAN POLYGON CLIPPING ALGORITHM
Aim:
To implement Sutherland Hodgeman Polygon clipping Algorithm
Functions used:
Line()
The function line() is used to draw a line from(x1,y1)to (x2,y2)
Syntax:
line (x1,y1,x2,y2)

initgraph().

19

This function takes thee arguments and they are


i).the video driver to be used (gd).
ii).the graphics mode (gm).
iii).the path name.
Syntax:
Initgraph(gd,gm,path)
Setcolor().
This function changes the drawing colour.
Syntax:
Setcolor(value of the color)
Settextstyle().
The function settextstyle() is used to change the style of the text.
Syntax:
Settextstyle(font,direction,charsize)
Where font is the constant value or the font filename, direction is the
number either 0 or 1, which makes the output to display in horizontal, or in
vertical direction, charsize is the character size or magnification factor and it
varies from 1 to 10.
Outtext().
This function display a text message on upper left of the screen
Syntax:
Outtext(message);

Algorithm:
Step 1. If first point inside add. If outside, dont add
Step 2.Move around polygon from vi to vn and back to v1
Step 3.Check vi,vi+1 wrt the clip edge
Step 4. Need vi,vi+1s inside/outside status
Step 5.Add vertex one at a time.
There are 4 cases:
foreach polygon P P = P
foreach clipping edge (there are 4) {
Clip polygon P to clipping edge
foreach edge in polygon P

20

Check clipping cases (there are 4)


Case 1 : Output vi+1
Case 2 : Output intersection point
Case 3 : No output
Case 4 : Output intersection point
Step 6.Stop

EX.NO:7
3D- TRANSFORMATION
Aim:
To perform 3D transformations such as translation, rotation and scaling.
Functions used:
Line()
The function line() is used to draw a line from(x1,y1)to (x2,y2)
Syntax:
line (x1,y1,x2,y2)
initgraph().
This function takes thee arguments and they are
i).the video driver to be used (gd).
ii).the graphics mode (gm).
iii).the path name.
Syntax:
Initgraph(gd,gm,path)
Algorithm:
Step 1. Create a class cube with function draw cube.
21

Step 2. Use the function draw cube to draw a cube using eight points by means of
functions line.
Step 3. Declare the variables x1, y1, x2, y2, x3, y3, in array type which of data type
int.
Step 4.Declare the variables theta,op,ch,tx,ty,sx,sy,sz,lz+xy,zf,i,x,y,z.
Step 5.Initialise graphics functions.
Step 6.Input the first point in the cube.
Step 7.Input the size of the edge.
Step 8.Create an object to call the function.
Step 9.Using switch operation select the operation to perform translation,
rotation,scaling.
Step 10.Translation
a).input the translation vectortx,ty,tz.
b).calculate points using formula
x3[i]=x1[i]+tx.
y3[i]=y1[i]+ty
z3[i]=z1[i]+tz.
x4[i]=x3[i]+z3[i]/2
y4[i]=y3[i]+z3[i]/2
c).using the function line, display the object before and after translation.
Step11. Rotation:
a). input the rotation angle
b). using formula theta=(theta*3.14)/180
c).input the direction in x,y,z axis
d). if the direction is along x axis,
x3[i]=x1[i].
y3[i]=y1[i]*cos(theta)-z1[i]*sin(theta),
y3[i]=y1[i]*sin(theta)-z1[i]*cos(theta),
if the direction is along yaxis,
y3[i]=y1[i].
z3[i]=z1[i]*cos(theta)-x1[i]*sin(theta),
x3[i]=z1[i]*sin(theta)-x1[i]*cos(theta),
if the direction is along z axis,
z3[i]=z1[i].
x3[i]=x1[i]*cos(theta)-y1[i]*sin(theta),
y3[i]=x1[i]*sin(theta)-y1[i]*cos(theta),
e).calculate the points using the formula
x4[i]=x3[i]+z3[i]/2
y4[i]=y3[i]+z3[i]/2
f). using the function line,display the object before and after rotation.
Step12. Scaling:
a).input the scaling factor and reference point
b).calculate coordinate point using formula
x3[i]=xf+(x1[i]*sx+xf*(1-sx),
y3 [i] =yf+ (y1[i]*sy+yf*(1-sy)
z3 [i] =zf+ (z1[i]*sz+zf*(1-sz)
c). calculate the points using the formula
x4[i]=x3[i]+z3[i]/2
y4[i]=y3[i]+z3[i]/2
22

d). using the function line, display the object before and after scaling.
Step13. Stop.

EX.NO:8
3D- COMPOSITE TRANSFORMATION
Aim:
To perform 3D composite transformations such as translation, rotation and
scaling.
Functions used:
Line()
The function line() is used to draw a line from(x1,y1)to (x2,y2)
Syntax:
line (x1,y1,x2,y2)
initgraph().
This function takes thee arguments and they are
i).the video driver to be used (gd).
ii).the graphics mode (gm).
iii).the path name.
Syntax:
Initgraph(gd,gm,path)
Algorithm:
Step 1.Translate P1 to the origin.
Step 2. Rotate about the y axis such that P1P2 lies in the (y, z) plane.
Step 3. Rotate about the x axis such that P1P2 lies on the z axis.
Step 4. Rotate about the z axis such that P1P3 lies in the (y, z) plane.

23

Step 5. Stop

EX.NO:9
DRAWING THREE DIMENSIONAL OBJECTS AND SCENES
Aim:
To draw a 3 Dimensional objects and scenes
Algorithm:
Step 1. Start
Step 2. Create a World Transformation coordinates.
Step 3. Create a Camera Transformation coordinates.
Step 4. Create a Prespective Transformation coordinates.
Step 5. Stop.

24

EX.NO:10.1
GENERATING FRACTAL IMAGES
Aim:
To generate a Fractal Images.
Algorithm:
The fractals of interest in this chapter can all be generated by the following classes
of algorithms:
Step 1.Linear replacement mapping - Fractal curves such as the Koch and
Sierpinski curves are generated by successive refinement of a given line by some
generator function.
Step 2.Iterated function systems - Many natural objects such as ferns and trees can
be generated by the successive application of a series of contractive affine
transformations.
Step 3.Complex plane mapping - Mathematical objects such as the Julia and
Mandelbrot sets are generated by successive mapping on the complex plane.
Step 4.Stochastic processes - Mountain landscapes and other irregular objects are
generated by applying random processes within a recursive algorithm.

25

EX.NO:10.2
CONVERSION BETWEEN COLOR MODELS (HSV to RGB color model)
HSV to RGB color model
Aim:
To write a program to convert HSV color model to RGB color model.
Algorithm:
Step1: initialize the graphics function
Step2: get the value of h, s and v.
Step3: for a set of TRGB values
HSV point correspond to RGB color values is set for V.
Parameter S is determined as relative distance from V.
Parameter h is determined by calculating
aa=v*(1-s).
bb= v*(s*f).
cc= v*(1-s*(1-f)).
Step4: apply the value to the equation and determined the values r,g,b

26

EX.NO:10.3
CONVERSION BETWEEN COLOR MODELS (RGB to HSV color model)
RGB to HSV color model
Aim:
To write a program to convert RGB color model to HSV color model.
Algorithm:

Algorithm:
Step1: initialize the graphics function
Step2: get the value of r,g and b.
Step3:set pointer v as maximum value *v=max
Step4:set pointer S
*s=delta/max;
Step5:set pointer h as
*h=NO_HUE;
*h=(g-b)/delta;
Step6:a).if r has maximum value
*h=(g-b)/delta;
b). if g has maximum value
*h=2+(b-r)/delta;
c). if b has maximum value
*h=4+(r-g)/delta;
Step7: find the r,s,b and v.

EX.NO:10.4
ANIMATION OF AN OBJECT

27

Aim:
To perform Animation of an object using flash.
Procedure:
Frame by frame:
Step1: Create a new document in flash.
Step2: Determine the frame rate of the animation, if case of fluring ball animation
set frame set fps.
Step3: In frame 1 create a ball using the over tool and place it in a starting position.
draw the flying arm with the initial shapes and post.
Step4: Choose modify/frames/convert to key frames. The content of frame are
copied into new key frames.
Step5: change the fly arms to the second position
Step6: by step 4 and 5 create animation for each frames and play
Step7: Exit out of the program
Result:
Thus the Animation of an object using flash was done and output was
verified.

EX.NO:10.5
BASIC OPERATION ON IMAGES

28

Aim:
To perform basic operation on images using Adobe Photoshop.
Procedure:
Feathering:
Select the elliptical marques tool on duplicate
Right click on area and select feather
Set the feather radius.
Filtering:

From filtering menu select B


From select radial Blue and motion Blue.
Set the angle and distance.
From filter menu, select liquefy which change the shape of flower.
From filter menu, select distart and then select glass.
Set distortion, smoothness and scaling for the object

Selection Tool:
This is used to select a portion of image and paste it in document.
Lasso Tool:
This is used to select the image in its shape.
Text Tool:
This is used to add text along with image.
Blur Tool:
This is used to change the image by its color, shape and dimension.
Painting Tool:
The powerful Photoshop paint engine lets you to simulate traditional
painting technique include charcoal, pastel and wet or dry brush effects.

Drawing Tool:
Draw resolution independent vector shapes instantly with the line,
rectangle, ellipse, polygon and custom shape tool.
Transformation Tools:
29

Scale, rotate, distor or skew engine easily. Apply the 3D transform filter to
simulate 3D effects such as tables and boxes. Using the liquefy command to
interactively push, pull, bucker or bloat an image
Sponge Tool:
The sponge tool subtly changes the color saturation of an area.in gray scale
mode,the tool increases or decreases contrast by moving gray level away from or
towards the middle gray.
Marques tools:
The marques tools let you to select rectangle, ellipse, rounded rectangular
and 1-pixel rows and columns by default, a selection border is dragged from its
corner.
Pen Tools:
The pen tools used in conjunction with the shape tools to create complex
shapes.
Result:
Thus the basic operations in animation using Flash was studied and
performed.

30

You might also like