Graphic and multimedia, Study notes of Computer Graphics and Animation

Computer scienceand graphi and multimedia subject

Typology: Study notes

2023/2024

Uploaded on 03/12/2024

naveen-kumar-ssv
naveen-kumar-ssv ๐Ÿ‡ฎ๐Ÿ‡ณ

2 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PURATCHI THALAIVI AMMA
GOVERNMENT ARTS AND SCIENCE COLLEGE
Affiliated to Bharathiar University Palladam โ€“ 641 664.
DEPARTMENT OF COMPUTER SCIENCE
Core Lab 7: Programming Lab โ€“ Graphics & Multimedia
LABORATORY RECORD
NAME :______________________ ROLL.NO :_____________
CLASS :______________________ SEMESTER:_____________
CERTIFIED BONAFIDE RECORD OF WORK DONE BY
NAME :______________________ ROLL.NO :_____________
CLASS :______________________ SEMESTER:_____________
PLACE : _______________ BATCH : _____________
DATE : _______________
SIGNATURE OF HOD STAFF INCHARGE
UNIVERSITY REGISTER NUMBER : ______________________
Submitted for University Semester Practical Examination held on ___________
INTERNAL EXAMINER EXTERNAL EXAMINER
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Graphic and multimedia and more Study notes Computer Graphics and Animation in PDF only on Docsity!

PURATCHI THALAIVI AMMA

GOVERNMENT ARTS AND SCIENCE COLLEGE

Affiliated to Bharathiar University Palladam โ€“ 641 664.

DEPARTMENT OF COMPUTER SCIENCE

Core Lab 7: Programming Lab โ€“ Graphics & Multimedia

LABORATORY RECORD

NAME :______________________ ROLL.NO :_____________

CLASS :______________________ SEMESTER:_____________

CERTIFIED BONAFIDE RECORD OF WORK DONE BY

NAME :______________________ ROLL.NO :_____________

CLASS :______________________ SEMESTER:_____________

PLACE : _______________ BATCH : _____________

DATE : _______________

SIGNATURE OF HOD STAFF INCHARGE

UNIVERSITY REGISTER NUMBER : ______________________

Submitted for University Semester Practical Examination held on ___________

INTERNAL EXAMINER EXTERNAL EXAMINER

CONTENTS

S. NO. DATE PROGRAM

PAGE

NO.

STAFF

SIGNATURE

GRAPHICS

1. ROTATE AN IMAGE

2. DROP A WORD

DROP A LINE USING DDA LINE

DRAWING ALGORITHM

MOVE A CAR WITH SOUND

EFFECT

BOUNCE A BALL WITH SOUND

EFFECT

CHECK PIXEL POSITION IN

POLYGON

MULTIMEDIA

7. SUN FLOWER

ANIMATE PLANE FLYING IN

CLOUDS

9. PLASTIC SURGERY

10. SEE-THROUGH TEXT

11. WEB PAGE

12. BLACK AND WHITE TO COLOR

line(x3,y3,x4,y4); line(x4,y4,x1,y1); setcolor(5); gotoxy(1,25); printf("\n\t Enter the reference point xr & yr:"); scanf("%d%d",&xr,&yr); putpixel(xr,yr,5); printf("\n\t Enter the angle:"); scanf("%d",&r); t=r3.14/180.0; x11=floor(xr+(x1-xr)cos(t)-(y1-yr)sin(t)); y11=floor(yr+(x1-xr)sin(t)+(y1-yr)cos(t)); x22=floor(xr+(x2-xr)cos(t)-(y2-yr)sin(t)); y22=floor(yr+(x2-xr)sin(t)+(y2-yr)cos(t)); x33=floor(xr+(x3-xr)cos(t)-(y3-yr)sin(t)); y33=floor(yr+(x3-xr)sin(t)+(y3-yr)cos(t)); x44=floor(xr+(x4-xr)cos(t)-(y4-yr)sin(t)); y44=floor(yr+(x4-xr)sin(t)+(y4-yr)*cos(t)); setcolor(15); setlinestyle(0,1,1); line(x11,y11,x22,y22); line(x22,y22,x33,y33); line(x33,y33,x44,y44); line(x44,y44,x11,y11); }

OUTPUT:

2D-ROTATION

Enter the x1 & y1 value L:250 300 Ente the x2 & y2 value L:250 400 Enter the x3 & y3 value L:500 400 Enter the x4 & y4 value L:500 300 2D-ROTATION Enter the reference point xr & yr: 250 300 Enter the angle: 90

outtextxy(150,20,"hai welcome to my world"); outtextxy(150,320,"hai"); outtextxy(200,320,"welcome"); outtextxy(273,20+i,"to"); cleardevice(); } } void drop::display4() { for(i=1;i<=300;i++) { outtextxy(150,20,"hai welcome to my world"); outtextxy(150,20,"hai"); outtextxy(200,320,"welcome"); outtextxy(273,320,"to"); outtextxy(303,20+i,"my"); delay(10); cleardevice(); } } void drop::display5() { for(i=0;i<=300;i++) { outtextxy(150,20,"hai welcome to my world"); outtextxy(200,320,"hai"); outtextxy(200,320,"welcome"); outtextxy(200,320,"to"); outtextxy(303,320,"my"); outtextxy(343,20+i,"world"); delay(10); cleardevice(); } } voidmain() { int gm,gd=DETECT; initgraph(&gd,&gm,"C:\TurboC3\BGI"); drop d; d.display(); d.display1(); d.display2(); d.display3(); d.display4(); d.display5(); outtextxy(150,150,"hai welcome to my world");getch(); }

OUTPUT:

hai welcome to my world world my to welcome hai hai welcome to my world

OUTPUT:

Enter the value of [x1,y1]:150 200 Enter the value of [x2,y2]:200 150

4. MOVE A CAR WITH SOUND EFFECT

#include<graphics.h> #include<conio.h> #include<math.h> #include<dos.h> int midx,midy,maxx,maxy; void displaycar(int c,int k) { setcolor(c); ellipse(50+k,midy+40,0,360,10,10); ellipse(100+k,midy+40,0,360,10,10); line(60+k,midy+40,90+k,midy+40); line(20+k,midy+40,40+k,midy+40); line(110+k,midy+40,130+k,midy+40); line(20+k,midy+40,20+k,midy+20); line(130+k,midy+40,130+k,midy+20); line(20+k,midy+20,30+k,midy+20); line(130+k,midy+20,100+k,midy+20); line(30+k,midy+20,30+k,midy); line(100+k,midy+20,100+k,midy); line(30+k,midy,100+k,midy); } void main() { int gd=DETECT,gm; int k=-20; initgraph(&gd,&gm,"C:\TurboC3\BGI"); midx=(maxx=getmaxx())/2; midy=(maxy=getmaxy())/2; line(0,midy-50,maxx,midy-50); line(0,midy+51,maxx,midy+51); setbkcolor(0); while(!kbhit()) { displaycar(5,k); sound(700); delay(50); displaycar(0,k-5); k+=5; if(k>=maxx) k=-20; } nosound(); getch(); closegraph(); }

5. BOUNCE A BALL WITH SOUND EFFECT

#include<dos.h> #include<graphics.h> #include<math.h> #include<conio.h> void main() { int gd=DETECT,gm,k; float x=1,y=0.00000,j=.5,count=.1; float r=10,i; initgraph(&gd,&gm,"C:\TurboC3\BGI"); setcolor(10); line(0,415,650,415); sleep(1); for(k=0;k<+7;k++) { for(i=90;i<270;i+=10) { y=cos(((i22/7)/180))/j; if(y>0) y=-y; x+=5; setcolor(10); setfillstyle(1,10); circle(x,y100+400,10); delay(100); nosound(); setcolor(0); setfillstyle(1,10); circle(x,y100+400,r); floodfill(x,y100+400,0); } sound(500); j+=count; count+=0.1; } nosound(); getch(); closegraph(); }

OUTPUT:

OUTPUT:

Enter no.of points used: Enter the co-ordinative points:50 100 Enter the co-ordinative points:150 200 Enter the co-ordinative points:100 50 Enter the co-ordinative points:200 150 Enter the finding pixel co-ordinate values:250 200 Given pixel are outside the polygon Enter no.of points used: Enter the co-ordinative points:50 100 Enter the co-ordinative points:150 200 Enter the co-ordinative points:100 50 Enter the co-ordinative points:200 150 Enter the finding pixel co-ordinate values:50 100 Given pixel are inside the polygon

7. SUN FLOWER

9. PLASTIC SURGERY

10. SEE-THROUGH TEXT