0% found this document useful (0 votes)
2 views39 pages

GM Record Final

The document is a record notebook for the Graphics & Multimedia Lab at Shree Venkateshwara Arts and Science College, detailing various programming exercises for a B.Sc in Computer Science. It includes algorithms and sample programs for tasks such as rotating an image, drawing lines, moving a car, and creating animations. Each exercise outlines the aim, algorithm, program code, and expected results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views39 pages

GM Record Final

The document is a record notebook for the Graphics & Multimedia Lab at Shree Venkateshwara Arts and Science College, detailing various programming exercises for a B.Sc in Computer Science. It includes algorithms and sample programs for tasks such as rotating an image, drawing lines, moving a car, and creating animations. Each exercise outlines the aim, algorithm, program code, and expected results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

SHREE VENKATESHWARA

ARTS AND SCIENCE (CO-EDUCATION) COLLEGE


Othakuthirai, Gobichettipalayam – 638 455.

(Affiliated to Bharathiar University – Coimbatore)

DEPARTMENT OF COMPUTER SCIENCE

Programming Lab: GRAPHICS & MULTIMEDIA LAB

Record Note Book

Name : _____________________________________

Reg.No. : _____________________________________
SHREE VENKATESHWARA
ARTS AND SCIENCE (CO-EDUCATION) COLLEGE
Othakuthirai, Gobichettipalayam – 638 455.

(Affiliated to Bharathiar University – Coimbatore)

DEPARTMENT OF COMPUTER SCIENCE

REGISTER NO:

This is to certify that bonafide record work of III-B.Sc (COMPUTER SCIENCE)


practical done by ___________________ during the SIXTH semester 2022-2023 for the
Core Lab 10: Graphics & Multimedia.

Staff-in-Charge Head of the department

Submitted to the Bharathiar University Practical Examination held on __________ at


Shree Venkateshwara Arts and Science (Co-Education) College, Othakuthirai.

INTERNAL EXAMINER EXTERNAL EXAMINER


CONTENTS

GRAPHICS

S.No Date Particulars Page Remarks


No
1 ROTATE AN IMAGE

2 DROP A WORD
DDA LINE DRAWING
3
ALGORITHM
4 MOVING A CAR

5 BOUNCE A BALL
CHECK PIXEL POSITION
6
IN POLYGON

MULTIMEDIA
1
SUNFLOWER
2
ANIMATE A PLANE
3
NOSE SURGERY
4 SEE THROUGH TEXT

5 WEB PAGE
BLACK & WHITE PHOTO
6 TO COLOR PHOTO
EX NO : 01
ROTATE AN IMAGE
DATE :

AIM:
To write a program to rotate an image.

ALGORITHM:

Step 1: Start the Process.

Step 2: Initialize the graphics mode, drive and path.

Step 3: Initialize the three values for triangle coordinates.

Step 4: Initialize the rotation value.

Step 5: Set the color to the shape using setcolor() function.

Step 6: Draw the shape using line() function.

Step 7: Rotate the given shape using the theta formula t = r * 3.14 / 180.0

function.

Step 8: Get the angle for rotation.

Step 9: Draw the shape using 2D rotate equation.

Step 10: Stop the process.


PROGRAM :
#include<graphics.h>

#include<conio.h>
#include<math.h>

#include<stdlib.h>

void main()

interr,gm,gd=DETECT;
int x1,x2,x3,y1,y2,y3,x1n,x2n,x3n,y1n,y2n,y3n,c;
int r;

float t;

clrscr();

initgraph(&gd,&gm,"C:\\TurboC3\\BGI");

outtextxy(10,10,"IMAGE ROTATION-ROTATING A TRIANGLE");


outtextxy(10,20,"****** ***************************");

x1=120;

y1=100;
x2=320;

y2=100;

x3=220;

y3=180;

r=45;
setcolor(WHITE);

outtextxy(10,50,"Before Rotation:");

setcolor(LIGHTRED);
line(x1,y1,x2,y2);

line(x2,y2,x3,y3);

line(x3,y3,x1,y1);

t=M_PI*r/180;
x1n=abs(x1*cos(t)-y1*sin(t));

y1n=abs(x1*sin(t)+y1*cos(t));

x2n=abs(x2*cos(t)-y2*sin(t));
y2n=abs(x2*sin(t)+y2*cos(t));

x3n=abs(x3*cos(t)-y3*sin(t));

y3n=abs(x3*sin(t)+y3*cos(t));
outtextxy(10,140,"After Rotation");

setcolor(YELLOW);

line(x1n,y1n,x2n,y2n);
line(x2n,y2n,x3n,y3n);

line(x3n,y3n,x1n,y1n);

getch();

}
OUTPUT :

RESULT :
EX NO : 02
DROP A WORD
DATE :

AIM :

To write a program to drop each word in a sentence one by one.

ALGORITHM:

Step 1: Start the Process.

Step 2: Initialize the graphics mode, drive and path.

Step 3: Get the sentence.

Step 4: Calculate the length of the sentence using strlen() function.

Step 5: Check if t [i] = “ “ then increment k & l value.

Step 6: Otherwise increment j & i value.

Step 7: Repeat the steps 5, 6 & 7 until the while condition is true.

Step 8: Calculate text width & display text within “for” loop.

Step 9: Drop the word using outtextxy() function.

Step 10: Stop the function


PROGRAM :

#include<graphics.h>

#include<conio.h>

#include<stdlib.h>
#include<stdio.h>

#include<dos.h>

#include<string.h>

void main()

{
intgd=DETECT,gm, i,j,k,l,x,y;
char s[100]=" ", sl[100]=" ";

initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");

printf("Enter the string:\n ");

gets(s);
y=50+textheight(s);

setviewport(45,y,500,400,0);
l=strlen(s);

s[l]=' ';

j=0;
for(i=0;i<=l;i++)

sl[j]=s[j];

if(s[i]==' '||s[i]=='\0')

{
for(y=50;y<=350;y+=30)

outtextxy(x,y,sl);

delay(100);

clearviewport();

x+=textwidth(sl);
for(k=0;k<j;k++)

sl[k]='\0';
j=-1;

j++;

getch();
}
OUTPUT :

RESULT :
EX NO : 03
DDA LINE DRAWING ALGORITHM
DATE :

AIM :
To create a program to drop a line using DDA line drawing algorithm.

ALGORITHM:

Step 1: Start the Process.

Step 2: Get the value of starting point and the ending point.

Step 3: Initialize the graphics mode, drive and path.

Step 4: Calculate dx,dy value based on points.

Step 5: If dx <= dy, then length = dx, otherwise length = dy.

Step 6: Again calculate dx, dy value based on length.

Step 7: Display the pixels using while loop.

Step 8: Increment the starting value.

Step 9: Repeat step 7 & 8 until the while condition is true.

Step 10: Stop the process.


PROGRAM :
#include<graphics.h>
#include<stdio.h>

#include<conio.h>

void main()
{

float x,y,x1,y1,delx,dely;

float slope;

int gr=DETECT,gm;

initgraph(&gr,&gm,"C:\\TurboC3\\BGI");
printf("\n Drawing a line using DDA Algorithm");
printf("\n ******* * **** ***** *** *********");

printf("\n Enter the initial coordinates points: ");

scanf("%f %f",&x,&y);

printf("\n Enter the ending coordinates points: ");


scanf("%f %f", &x1,&y1);

dely=y1-y;
delx=x1-x;

slope=dely/delx;

if(slope>1.0)
{

while(y<=y1)

putpixel(x,y,1);

x=x+(1/slope);
y=y+1.0;

else

while(x<=x1)

{
putpixel(x,y,1);

y=y+slope;
x=x+1.0;

getch();
}
OUTPUT :

RESULT :
EX NO : 04
MOVING A CAR
DATE :

AIM :
To write a program to move a car with sound effect.

ALGORITHM:

Step 1: Start the Process.

Step 2: Initialize the graphics mode, drive and path.

Step 3: Draw the car’s body shape using line() function.

Step 4: Draw the wheel circle using circle() function.

Step 5: Set the background color using setcolor() function.

Step 6: Set the red color to car body using setcolor() function..

Step 7: The car move using incrementing the line and circle function i

valueswith sound using sound() function.

Step 8: Stop the process


PROGRAM :
#include<graphics.h>

#include<stdio.h>

#include<conio.h>

void main()

inti,xgd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");

for(i=0;i<=420;i=i+10)
{

setcolor(RED);

sound(100);

line(0+i,300,210+i,300);
line(50+i,300,75+i,270);

line(75+i,270,150+i,270);
line(150+i,270,165+i,300);
line(0+i,300,0+i,330);

line(210+i,300,210+i,330);

circle(65+i,330,15);

circle(65+i,330,2);

circle(145+i,330,15);
circle(145+i,330,2);

line(0+i,330,50+i,330);

line(80+i,330,130+i,330);

line(210+i,330,160+i,330);
delay(100);

setcolor(BLACK);

line(0+i,300,210+i,300);

line(50+i,300,75+i,270);

line(75+i,270,150+i,270);

line(150+i,270,165+i,300);

line(0+i,300,0+i,330);
line(210+i,300,210+i,330);

circle(65+i,330,15);
circle(65+i,330,2);

circle(145+i,330,15);

circle(145+i,330,2);

line(0+i,330,50+i,330);
line(80+i,330,130+i,330);

line(210+i,330,160+i,330);
}
nosound();

getch();

closegraph();

}
OUTPUT :

RESULT :
EX NO : 05
BOUNCE A BALL
DATE :

AIM:
To write a program to bounce a ball with sound effects.

ALGORITHM:
Step1: Start the process.

Step2: Initialize the graphics mode, drive and path.

Step 3: Initialize the x, j, y=0, c=1 and t=400.

Step 4: Set the red color to the ball using setcolor() function.

Step 5: Fill the pattern SOLID_FILL,RED using setfillstyle() function.

Step 6: Draw the circle in for loop using circle() function.

Step 7: Fill the backfround using the floodfill() function.

Step 8: If the y value is y<=(400-t) change the c value c=1 and t-20.

Step 9: Create the sound using sound() function.

Step 10 :If the y value is y <=(400-t) change the c=1for bouncing the ball.

Step 11: Stop the process.


PROGRAM :
#include<stdio.h>

#include<conio.h>

#include<graphics.h>

#include<dos.h>

void main()

intgd=DETECT,gm=DETECT;

intx,y=0,j,t=400,c=1;

initgraph(&gd,&gm,"C:\\Turboc3\\BGI");

setcolor(RED);

setfillstyle(SOLID_FILL,RED);

for(x=40;x<602;x++)

cleardevice();

circle(x,y,30);

floodfill(x,y,RED);

delay(40);

if(y>=400)

sound(120);

c=0;

t=20;
}

if(y<=(400-t))

c=1;

y=y+(c?15:-15);

nosound();

getch();

}
OUTPUT :

RESULT :
EX NO : 06
CHECK PIXEL POSITION IN POLYGON
DATE :
AIM :
To write a program to test whether given pixel is inside or outside a
polygon.

ALGORITHM:
Step 1: Start the Process.

Step 2: Initialize the graphics drive, mode and path.

Step 3: Get the values of inputs n.

Step 4: Get the co-ordinate value within “for” loop.

Step 5: Draw the polygon shape using fillpoly() function.

Step 6: Get any pixel value.

Step 7: Get the color of particular pixel using getpixel() function.

Step 8: If b = 0, display outside the pixel.

Step 9: Otherwise display inside the pixels.

Step 10: Stop the process.


PROGRAM :
#include<stdio.h>
#include<graphics.h>

#include<conio.h>

void main()
{

intgd=DETECT,gm;

int a[10],i,j,n,x,y,b;

cirscr();

initgraph(&gd,&g,"C:\\TURBOC3\\BGI");
printf("\n TEST THE GIVEN POINTS INSIDE\OUTSIDE\ONLISE IN POLYGON");
printf("\n***** *** ***** ****** ********************** ** *******");

printf("\n Enter the no.of point useed:");

scanf("%d",&n);

for(i=0,j=0;i<n;i++,j+=2)
{

printf("\n\t Enter the co-ordinate points one to one:");


scanf("%d%d",&a[j],&a[j+1]);

setcolor(10);
fillpoly(n,a);

printf("\n Enter the pixel co-ordinate values to be find:");

scanf("%d%d",&x,&y);

b=getpixel(x,y);

putpixel(x,y,2);
printf("\n b=%",b);

if(b==15)

printf("\n\n Gives pixel is inside the polygon");

else if(b==10)

printf("\n\n Gives pixel is on the polygon");

else

printf("\n\n\t Gives pixel is outside the polygon");


getch();

closegraph();
}
OUTPUT :

RESULT :
EX NO : 07
SUN FLOWER
DATE :
AIM:
To create a SUN FLOWER using Photoshop.

ALGORITHM:
Step 1: Start the Process.

Step 2: Open a new file in file menu.

Step 3: Select custom shape tool in the tool box.

Step 4: Choose a flower shape and then click and drag it.

Step 5: Choose a stem shape and then click and drag it.

Step 6: Select foreground color and layer style to change the color of the
shape

Step 7: Stop the process.


RESULT :
EX NO : 08
ANIMATE A PLANE
DATE :
AIM:
To ANIMATE A PLANE using Photoshop.

ALGORITHM:
Step 1: Start the Process.

Step 2: Open a new file in file menu.

Step 3: Select custom shape tool Plane Shape to draw a plane & color the
shape.

Step 4: Choose rectangle tool to draw some rectangle shapes and color the
shape.

Step 5: Click the Image ready option for animate plane.

Step 6: Add a new video layer and move the plane to another destination.

Step 7: Again and Again add some layers to move the plane like fly.

Step 8: Click the play button to run the animation.

Step 9: Now Plane is animated.

Step 10: Stop the process.


RESULT :
EX NO : 09
NOSE SURGERY
DATE :

AIM:
To make a NOSE SURGERY using Photoshop.

ALGORITHM:
Step 1: Start the Process.

Step 2: Open a photo1 which is need to get surgery, in file menu.

Step 3: Open another photo2 which is have a nice nose, in file menu.

Step 4: Select Lasso tool in toolbox to cut the noses of these two photos.

Step 5: Photo1 nose is erased and Photo2 nose is duplicate using Ctrl+J.

Step 6: Select Move tool to move the duplicated nose to photo1 by .


dragging.

Step 7: Resize the nose by Ctrl+T.

Step 8: Drag on the cutted nose point to attach the new nose.

Step 9: Select Erase tool to erase unwanted skin.

Step 10: Now nose is surgeried.

Step 11: Stop the process.


Before

After

RESULT :
EX NO : 10
SEE THROUGH TEXT
DATE :

AIM:
To create SEE THROUGH TEXT using Photoshop.

ALGORITHM:
Step 1: Start the Process.

Step 2: Open an image for background in file menu.

Step 3: Choose Text tool in Tool box.

Step 4: Type a text and choose impact for clear visual.

Step 5: Change the text size to be bigger.

Step 6: Click & hold layer thumbnail(text) then press Ctrl button to select
the layer.

Step 7: Select background image.

Step 8: Click Ctrl+J for duplicate the selected part in background image.

Step 9: Click to off icon of Text layer and Background or delete these
layers.

Step 10: Now can see the background through the text.

Step 11: Stop the process.


Before

After

RESULT :
EX NO : 11
WEB PAGE
DATE :
AIM:
To create WEB PAGE using Photoshop.

ALGORITHM:
Step 1: Start the Process.

Step 2: Open a new file in file menu.

Step 3: Draw rectangle shape using rectangle tool and add web page title.

Step 4: Open a logo and add beside of title.

Step 5: Draw another rectangle below of title card and decrease the
opacity to 70%.

Step 6: Draw some small rectangles on the blended rectangle.

Step 7: Give some modules name on the small rectangles using text tool.

Step 8: Add some related images of this website.

Step 9: Give the details of this web page by text tool.

Step 10: Web page Created.

Step 11: Stop the process.


RESULT :
EX NO : 12 BLACK & WHITE PHOTO
TO COLOR PHOTO
DATE :
AIM:
To Convert Black & White Photo to Color Photo using Photoshop.

ALGORITHM:
Step 1: Start the Process.

Step 2: Take a black & white photo.

Step 3: Create a new layer using Shift+Ctrl+N.

Step 4: Choose brush tool for coloring by click B.

Step 5: Select a color in foreground color.

Step 6: Paint into the shape or image.

Step 7: Select blending mode to choose overlay mode.

Step 8: Black & White image now converted to color image.

Step 9: Stop the process


Before

After

RESULT :

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy