GM Record Final
GM Record Final
Name : _____________________________________
Reg.No. : _____________________________________
SHREE VENKATESHWARA
ARTS AND SCIENCE (CO-EDUCATION) COLLEGE
Othakuthirai, Gobichettipalayam – 638 455.
REGISTER NO:
GRAPHICS
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 7: Rotate the given shape using the theta formula t = r * 3.14 / 180.0
function.
#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");
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 :
ALGORITHM:
Step 7: Repeat the steps 5, 6 & 7 until the while condition is true.
Step 8: Calculate text width & display text within “for” loop.
#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");
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 2: Get the value of starting point and the ending point.
#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 ******* * **** ***** *** *********");
scanf("%f %f",&x,&y);
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 6: Set the red color to car body using setcolor() function..
Step 7: The car move using incrementing the line and circle function i
#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.
Step 4: Set the red color to the ball using setcolor() function.
Step 8: If the y value is y<=(400-t) change the c value c=1 and t-20.
Step 10 :If the y value is y <=(400-t) change the c=1for bouncing the ball.
#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.
#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***** *** ***** ****** ********************** ** *******");
scanf("%d",&n);
for(i=0,j=0;i<n;i++,j+=2)
{
setcolor(10);
fillpoly(n,a);
scanf("%d%d",&x,&y);
b=getpixel(x,y);
putpixel(x,y,2);
printf("\n b=%",b);
if(b==15)
else if(b==10)
else
closegraph();
}
OUTPUT :
RESULT :
EX NO : 07
SUN FLOWER
DATE :
AIM:
To create a SUN FLOWER using Photoshop.
ALGORITHM:
Step 1: Start the Process.
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
ALGORITHM:
Step 1: Start the Process.
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 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.
AIM:
To make a NOSE SURGERY using Photoshop.
ALGORITHM:
Step 1: Start the Process.
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 8: Drag on the cutted nose point to attach the new nose.
After
RESULT :
EX NO : 10
SEE THROUGH TEXT
DATE :
AIM:
To create SEE THROUGH TEXT using Photoshop.
ALGORITHM:
Step 1: Start the Process.
Step 6: Click & hold layer thumbnail(text) then press Ctrl button to select
the layer.
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.
After
RESULT :
EX NO : 11
WEB PAGE
DATE :
AIM:
To create WEB PAGE using Photoshop.
ALGORITHM:
Step 1: Start the Process.
Step 3: Draw rectangle shape using rectangle tool and add web page title.
Step 5: Draw another rectangle below of title card and decrease the
opacity to 70%.
Step 7: Give some modules name on the small rectangles using text tool.
ALGORITHM:
Step 1: Start the Process.
After
RESULT :