Professional Documents
Culture Documents
Name :
Reg No :
GRAPHICS LAB
SL #. LAB EXERCISES DATE SIGNATURE
1. DDA LINE DRAWING
ALGORITHM
2. BRESENHAMS LINE
DRAWING ALGORITHM
3. MID POINT CIRCLE
DRAWING ALGORITHM
4. LINE STYLES
5. FILL PATTERN STYLES
6. SHAPES
7. WHEEL ROTATION
8. LINE CLIPPING
9. 2D - TRANSFORMATION
10. BAR CHART
11. LINE CHART
Multimedia Lab
SL #. LAB EXERCISES DATE SIGNATURE
1. LOGO CREATION
2. DISPLACEMENT
EFFECT
3. ANIMATION EFFECT
4. MIRROR IMAGE
5. MORPHING
Staff Name :
Staff Signature :
Exp No :
Date :
AIM:
To write a program to implement the DDA line drawing
algorithm.
ALGORITHM:
Start
dx=abs(xa-xb)
dy =abs(ya-yb)
Step=dx Step=dy
xl = dx/ step
y1=dy/step
x = xa
y=ya
A
A
putpixel(x,y,1)
For(k=1;k <=step;k++)
x=x+x1
x= x+0.5
y=y+y1
y= y+0.5
putpixel(x,y,1)
Stop
PROGRAM:
#include<graphics.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
void drawline(int xl,int y1,int x2;int y2)
{
int dx,dy,steps,k;
float xinc,yinc,x,y;
int gdriver=DETECT,gmode,errorcode;
initgraph(&gdriver,&gmode,"");
dx=x2-x1 ;
dy=y2-y1;
if(abs(dx)>abs(dy))
steps=abs(dx);
else
steps=abs(dy);
xinc=dx/steps;
yinc=dy/steps,
x=x1;
y=y1;
putpixel(x,y,3);
for(k=1;k<steps;k++)
{
x+=xinc;
y+=yinc;
putpixel(x,y,3);
}
getch();
closegraph();
}
void main()
{
int x1,y1,x2,y2;
clrscr();
printf("Enter The 1st Coordinate");
scanf("%d %d",&x1,&y1);
printf('Enter The 2nd Coordinate");
scanf("%d %d",&x2,&y2);
drawline(x1,y1,x2,y2);
}
OUTPUT
RESULT:
Thus the program was executed successfully and the output was
verified.
Exp No :
Date :
AIM:
To implement BRESENHAM line drawing algorithm using C.
ALGORITHM:
Start
dx=abs(xa-xb)
dy =abs(ya-yb)
K=2*(dy-dx)
If (xa >xb)
X =xb X =xa
Y=yb Y=ya
Xe=xb Xe=xb
Putpixel(x,y,1)
A
A
For (x<xe)
X=x+1
If(k>0)
Y=y+1
K=k+2*dy K+=2*(dy-dx)
Next
Stop
PROGRAM:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
#include<graphics.h>
void main()
{
float xa,xb,ya,yb,dx,dy,k,xe,x,y;
/* REQUEST AUTO DETECTION */
int gdriver = DETECT,gmode,errorcode;
/* INITIALIZE GRAPHICS MODE */
initgraph(&gdriver,&gmode,"");
printf("BRESENHAMS ALGORITHM \N enter the value\n");
scanf("%f%f%f%f",&xa,&ya,&xb,&yb);
dx=abs(xa-xb);
dy=abs(ya-yb);
k=2*(dy-dx);
if(xa>xb)
{
x=xb;
y=yb;
xe=xa;
}
else
{
x=xa;
y=ya;
xe=xb;
}
putpixel(x,y,1);
while(x<xe)
{
x=x+ 1;
if(k<0)
k=k+2*dy;
else
{
y=y+1;
k+=2*(dy-dx);
}
putpixel(x,y, 1);
} getch();
}
OUTPUT:
RESULT:
Thus the program to implement the Bresenham’s Line drawing
algorithm was executed successfully.
Exp No :
Date :
ALGORITM:
Start
Input radius,
center point
p=1-radius
x=0,y=radius plotpoints
plotpoints
Set the initial
point
For p<0
Next
Stop
PROGRAM:
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
void plotpoints(int xc,int yc,int x,int y)
{
putpixel(xc+x,yc+y,5);
putpixel(xc-x,yc+y,5);
putpixel(xc+x,yc-y,5);
putpixel(xc-x,yc-y,5);
putpixel(xc+y,yc+x,5);
putpixel(xc-y,yc+x,5);
putpixel(xc+y,yc-x,5);
putpixel(xc-y,yc-x,5);
}
void drawcircle(int xc,int yc,int radius)
{
int p,x=0,y=radius;
plotpoints(xc,yc,x,y);
p=1-radius;
while(x<y)
{
if(p<0)
x++;
else
{
x++;
y--;
}
if(p<0)
p+=2*x+1 ;
else
p+=2*(x-y)+1;
plotpoints(xc,yc,x,y);
}
}
void main()
{
int x,y,r;
int gdriver = DETECT,gmode,errorcode;
/* INITIALIZE GRAPHICS MODE */
initgraph(&gdriver,&gmode,"");
printf("Enter the Coordinates");
scanf("%d%d",&x,&y);
printf("Enter the radius :");
scanf("%d",&r);
drawcircle(x,y,r);
getch();
}
OUTPUT:
RESULT:
Thus the program to implement the mid point circle
drawing algorithm was executed successfully and output is
verified.
Exp No :
Date :
LINE STYLES
AIM:
To write a program implementing the various line styles
using C
ALGORITHM:
Step 1: Input the line coordinates
Step 2: Set a line style
Step 3: Draw line using the line style
Step 4: Repeat steps 1,2 and 3 for all line styles
FLOWCHART: LINE STYLES
Start
Input line
coordinates
Next
Stop
PROGRAM:
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm,maxy,x,style;
char str[40];
struct linesettingstype ls;
initgraph(&gd,&gm,"");
maxy=getmaxy();
setcolor(RED);
outtextxy(10,20,"normal width");
x=20;
for(style=0;style<4;style++)
{
setlinestyle(style,0,1);
getlinesettings(&ls);
setlinestyle(style,0,1);
line(x,50,x,maxy-50);
itoa(style,str,10);
outtextxy(x,maxy-20,str);
x=x+50;
setlinestyle(ls.linestyle,ls.upattern,ls.thickness);
}
outtextxy(375,20,"thick width");
x=375;
for(style=0;style<4;style++)
x=375;
for(style=0;style<4;style++)
{
setlinestyle(style,0,3);
line(x,50,x,maxy-50);
itoa(style,str,10);
outtextxy(x,maxy-20,str);
x=x+50;
setlinestyle(ls.linestyle,ls.upattern,ls.thickness);
}
getch();
closegraph();
restorecrtmode();
}
OUTPUT:
RESULT:
Thus the program to implement different line styles
is executed successfully.
Exp No :
Date :
AIM:
To write a program implementing the various fill
patterns using C.
ALGORITHM:
Start
Input bar
coordinates
Draw bar
Fill bar
Next
Stop
PROGRAM:
#include<graphics.h>
#include<stdlib.h>
#include<conio.h>
void main()
{
int gd=DETECT,gm,maxx,maxy,x=40,y=40,fst;
char str[40];
char *pattern[]={ "empty_fill","solid_fill","line_fill","ltslash_fill",
"ltbkslash_fill","hatch_fill","xhatch_fill",
"interleave_fill", "wide_dot_fill","close_dot_fill","user_fill"};
initgraph(&gd,&gm,"");
maxx=getmaxx();
maxy=getmaxy();
rectangle(0, 10,maxx,maxy);
setcolor(MAGENTA);
outtextxy(175,0,"pre defined fill styles");
for(fst=0; fst< 12;fst++)
{
setfillstyle(fst,YELLOW);
bar(x,y,x+80,y+80);
itoa(fst,str,10);
outtextxy(x,y+100,str);
outtextxy(x,y+110,pattern[fst]);
x+=150;
if(x>490)
{
y+=150;
x=40;
}
}
getch();
closegraph();
restorecrtmode();
}
OUTPUT:
RESULT:
Thus the program to implement the fill style
patterns is executed successfully.
Exp No :
Date :
SHAPES
AIM:
To write a program in C to show the following shapes:
ALGORITHM:
Start
Input Shape
Input Shape
Details
Initialise
pi, twopi, theta, dtheta
For (shape is
continued
Draw points
Next
Stop
PROGRAM:
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm,maxy,x,style;
char str[40];
struct linesettingstype ls;
initgraph(&gd,&gm,"");
maxy=getmaxy();
setcolor(RED);
outtextxy(10,20,"normal width");
x=20;
for(style=0;style<4;style++)
{
setlinestyle(style,0,1);
getlinesettings(&ls);
setlinestyle(style,0,1);
line(x,50,x,maxy-50);
itoa(style,str,10);
outtextxy(x,maxy-20,str);
x=x+50;
setlinestyle(ls.linestyle,ls.upattern,ls.thickness);
}
outtextxy(375,20,"thick width");
x=375;
for(style=0;style<4;style++)
x=375;//shape generation, exp no - 8
#include<math.h>
#include<graphics.h>
#include<conio.h>
#include<stdio.h>
struct wcp
{
int x,y;
};
int fig;
void polyline(int x, wcp *y)
{
for(int i=0;i<x;i++)
line(y[i].x,y[i].y,y[i+1].x,y[i+1].y);
}
for(style=0;style<4;style++)
{
setlinestyle(style,0,3);
line(x,50,x,maxy-50);
itoa(style,str,10);
outtextxy(x,maxy-20,str);
x=x+50;
setlinestyle(ls.linestyle,ls.upattern,ls.thickness);}
getch();
closegraph();
restorecrtmode();
}
OUTPUT:
1:CARDIOD
2:THREELEAF
3:SPIRAl
4:FOURLEAF
RESULT:
Thus the program to implement the shapes is executed
successfully and output is verified.
Exp No :
Date :
WHEEL ROTATION
AIM:
To write a program to show the rotation of a wheel
using C.
ALGORITHM:
Start
Input Center
Input No of
Spikes
Draw Wheel
For(Key not
hit)
Delay
Draw Wheel
Next
Stop
PROGRAM:
#include<stdio.h>
#include<graphics.h>
#include<math.h>
#include<conio.h>
#include<dos.h>
void main()
{
float k,k1;
int n,xc,yc,r,i,xa,ya;
void wcircle(int,int,int);
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
printf("Enter The Circle & Radius:");
scanf("%d %d %d",&xc,&yc,&r);
printf("\nEnter The No. Of Slices:");
scanf("%d",&n);
circle(xc,yc,r);
k=6.28/n;
k1=k;
while(!kbhit())
{
circle(xc,yc,r);
for(i=0;i<n;i++)
{
xa=xc+(r*cos(k1));
ya=yc+(r*sin(k1));
line(xc,yc,xa,ya);
k1=k1+k;
}
delay(10);
cleardevice();
}
getch();
closegraph();
}
OUTPUT:
RESULT:
Thus the program to implement wheel rotation is
executed successfully.
Exp No :
Date :
LINE CLIPPING
AIM:
To write a program to show the Clipping Window using C.
ALGORITHM:
Step l: Initialize the graphics
Step 2: Enter the coordinates for the Clipping Window
Step 3: Enter the first coordinates of the line to be
clipped
Step 4: Enter the second coordinates of the line to be
clipped
Step 5: Declare afunction box() to draw the clipping window
Step 6: Declare a functionaccept() to accept the points
inside the clipping window
Step 7: Declare a functionreject() to CLIP the points
outside the clipping window.
FLOWCHART: LINE CLIPPING
Start
Initialize the
Graphics
Stop
PROGRAM:
#include<graphics.h>
#include<conio.h>
#include<math.h>
void box();
void encode(int k1,int y1,int c[5]);
int accept(int a[4],int b[4]);
int reject(int a[4],int b[4]);
int ptinside(int a[5]);
void swap(int *a,int *b);
int wx1,wy1,wx2,wy2,a[6],b[6];
void main()
{
int gdriver=DETECT,gmode;
int a[5],b[5];
int x1,y1,x2,y2,i,j;
int done=0;
int draw=0;
float m;
initgraph(&gdriver,&gmode," ");
printf("\n\t\t LINE CLIPPING");
printf("\n\t\t----------- ");
printf("\n\t\t Enter window coordinates");
scanf("%d%d%d%d",&wx1,&wy1,&wx2,&wy2);
printf("\n Coordinates for line");
scanf("%d%d",&x1,&y1);
printf("\n Coordinates for line");
scanf("%d%d",&x2,&y2);
cleardevice();
printf("\n\tBEFORE CLIPPING");
box();
line(x1,y1,x2,y2);
cleardevice();
getch();
printf("\n\tAFTER CLIPPING");
box();
while(!(done))
{
encode(x1,y1,a);
encode(x2,y2,b);
if(accept(a,b))
{
done=1;
draw=1;
}
else if(reject(a,b))
done=1;
else if(ptinside(a))
{
swap(&x1,&x2);
swap(&y1,&y2);
for(i=1;i<=4;i++)
swap(&a[i],&b[i]);
}
m=(y2-y1)/(x2-x1);
if(a[1])
{
y1=y1+(wx1-x1)*m;
x1=wx1;
}
else if(a[2])
{
y1= y1+(wx2-x1)*m;
x1 =wx2;
}
else if(a[3])
{
x1=x1+(wy1-y1)/m;
y1=wy1;
}
else if(a[4])
{
x1=x1+(wy2 -y1)/m;
y1=wy2;
}
}
box();
if(draw)
line(x1,y1,x2,y2);
getch();
}
void box()
{
line( wx1,wy1,wx2,wy1);
line( wx2,wy1,wx2,wy2);
line( wx2,wy2,wx1,wy2);
line( wx1,wy2,wx1,wy1);
}
void encode(int x , int y, int c[5])
{
if(x<wx1)
c[1] = 1;
else
c[1] = 0;
if(x>wx2)
c[2] = 1;
else
c[2] = 0;
if(y<wy1)
c[3] = 1;
else
c[3] = 0;
if(y>wy2)
c[4] = 1;
else
c[4] = 0;
}
int accept (int a[4] , int b[4] )
{
int t =1;
int i;
for(i=1; i<=4; i++)
{
if(( a[i])||( b[i] ))
t=0;
}
return(t);
}
int reject(int a[4] int b[4] )
{
int t=0;
int i;
for( i=1;i<=4;i++)
{
if((a[i]) && (b[i]))
t=1;
}
return(t);
}
int ptinside( int a[5])
{
if((a[1])||(a[2])||(a[3])||(a[4]))
return(0);
else
return(1);
}
void swap(int *a, int *b)
{
int *temp;
*temp =*a;
*a= *b;
*b =*temp;
}
OUTPUT:
RESULT:
Thus the program to implement the line clipping is
executed successfully
Exp No :
Date :
2D - Transformation
AIM:
To write a program to show the 2D - Transformation
using C.
ALGORITHM:
Start
Enter your
choice
for Shifting
Scaling Rotating
Read K
rotation
shifting scaling
A B C
Closegraph
Stop
PROGRAM:
#include<conio.h>
#include<dos.h>
#include<math.h>
#include<stdlib.h>
#include<graphics.h>
int xc,yc,r,x,y,p,g,s,i,k;
float q;
void main()
{
int gdriver=DETECT,gmode,errorcode;
initgraph(&gdriver,&gmode,"");
printf("\nl.shifting\n2.scaling\n3.rotation");
printf("\nenter your choice : ");
scanf("%d",&k);
switch(k)
{
case 1:
{
printf("CIRCLE DRAWING ALGORITHM\n enter the value for xc yc r: ");
scant("%d%d%d",&xc,&yc,&r);
circle(xc,yc,r);
printf("\nenter the position to shift: ");
scanf("%d",&s);
for(i=0;i<s;i++)
{
xc++;
yc++;
cleardevice();
circle(xc,yc,r);
delay(60);
}
break;
}
case 2:
{
printf("CIRCLE DRAWING ALGORITHM\n enter the value for xc yc r: ");
scanf("%d%d%d",&xc,&yc,&r);
circle(xc,yc,r);
printf("\nenter the value for scaling: ");
scanf("%d",&g);
for(i=0;i<g;i++)
{
r++;
cleardeviceO;
circle(xc,yc,r);
delay(60);
}
break;
}
case 3:
{
cleardevice();
x=200;y=200;
moveto(200,200);
lineto(300,200);
printf("\n enter an angle: ");
scanf("%f",&q);
q=3.14*q/180;
x=200+100*cos(q);
y=200+100*sin(q);
cleardevice();
moveto(200,200);
lineto(x,y);
break;
}
}
getch();
closegraph();
}
OUTPUT:
RESULT:
Thus the program to implement to show the 2-D
transformation is compiled and executed successfully.
Exp No :
Date :
BAR CHART
AIM:
To write a program to plot a bar chart for some given
data using C.
ALGORITHM:
Draw Labels
Next i
Stop
PROGRAM:
#include<stdio.h>
#include<graphics.h>
#include<string.h>
#include<math.h>
#include<conio.h>
int const monthcount=l2,dataoffset=l8;
struct indata
{
float realarray[12];
float array[ 12];
}
char getlabel[3];
indata data;
int monthplace[12];
float interval,chartbottom,radius;
struct wcp
{
float x;
float y;
} coord[monthcount];
wcp center;
int round(float a)
{
int b;
b=a;
if(a-b>0.5)
return ++b;
else
return b;
}
void mybar(int x, wcp *y)
{
setfillstyle(SOLID_FILL,8);
for(int i=0;i<x;i++)
bar(y[i].x,y[i].y,y[i].x+40,chartbottom-dataoffset);
}
void getlab(int x)
{
switch(x)
{
case 0:
{
strcpy(getlabel,"JAN");
break;
}
case 1:
{
strcpy(getlabel,"FEB");
break;
}
case 2:
{
strcpy(getlabel ,"MAR");
break;
}
case 3:
{
strcpy(getlabel,"APR");
break;
}
case 4:
{
strcpy(getlabel,"MAY");
break;
}
case 5:
{
strcpy(getlabel,"JUN");
break;
}
case 6:
{
strcpy(getlabel,"JUL");
break;
}
case 7:
{
strcpy(getlabel,"AUG");
break;
}
case 8:
{
strcpy(getlabel,"SEP");
break;
}
case 9:
{
strcpy(getlabel,"OCT");
break;
}
case 10:
{
strcpy(getlabel,"NOV");
break;
}
case 11:
{
strcpy(getlabel,"DEC");
break;
}
}
}
void getdata()
{
float t1=0.00,t2;
for(int t=0;t<12;t++)
getlab(t);
printf("ENTER THE DATA FOR THE MONTH OF %s ",getlabel);
scanf("%f ",&data.realarray[t]);
if(data.realarray[t]>t1 )
tl =data.realarray [t];
for(t=0;t<12;t++)
{
t2=data.realarray[t]/t1 ;
data.array[t]=t2*400;
}
}
void puttext(wcp textp)
{
settextstyle(1,HORIZ_DIR,1);
outtextxy(textp.x,textp.y,getlabel);
}
void drawlabels()
{
wcp textposition;
textposition.y=chartbottom;
int zz=25;
for(int az=0;az<12;az++)
{
textposition.x=zz;
zz+=50;
getlab(az);
puttext(textposition);
}
}
char valuep[5];
void findvaluep(int x)
{
int y=x,ttt;
char tg[5];
strcpy(tg,"");
do
{
ttt=y%10;
switch(ttt)
{
case 0:
{
strcat(tg,"0");
break;
}
case 1:
{
strcat(tg,"1");
break;
}
case 2:
{
strcat(tg,"2");
break;
}
case 3:
{
strcat(tg,"3");
break;
}
case 4:
{
strcat(tg,"4");
break;
}
case 5:
{
strcat(tg,"5 ");
break;
}
case 6:
{
strcat(tg,"6");
break;
}
case 7:
{
strcat(tg,"7");
break;
}
case 8:
{
strcat(tg,"8");
break;
}
case 9:
{
strcat(tg,"9");
break;
}
}
y/=10;
} while(y>0);
strcpy(valuep,"");
for(y=0;y<strlen(tg);y++)
valuep[y]=tg[strlen(tg)-y-1];
valuep[y]=NULL;
}
void barchart()
{
drawlabels();
settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
for(int t=0;t<monthcount;t++)
{
coord[t].x=monthplace[t];
coord[t].y=450-data.array [t]-dataoffset;
findvaluep(data.realarray[t]);
outtextxy(coord[t].x,coord[t].y-l 0,valuep);
}
mybar(monthcount,coord);
}
void main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
getdata();
cleardevice();
chartbottom=450.0;
interval=50.0;
monthplace[0]=25;
for(int z=1;z<monthcount;z++)
monthplace[z]=monthplace[z-1 ]+interval;
linechart();
getch();
cleardevice();
barchart();
getch();
cleardevice();
center.x=300;
center.y=205;
radius=200;
piechart();
getch();
closegraph();
}
OUTPUT
RESULT:
Thus the program to implement to show the Bar Chart
is compiled and executed successfully.
Exp No :
Date :
LINE CHART
AIM:
To write a program to plot a line chart for some given
data using C.
ALGORITHM:
FLOWCHART: LINECHART
Start
Draw Labels
Set p & q
Draw a line
between p and q
Next i
Stop
PROGRAM:
#include<stdio.h>
#include<graphics.h>
#include<string.h>
#include<math.h>
#include<conio.h>
int const monthcount=12,dataoffset=18;
struct indata
{
float realarray[ 12];
float array[ 12];
}
char getlabel[3];
indata data;
int monthplace[ 12];
float interval,chartbottom,radius;
struct wcp
{
float x;
float y;
} coord[monthcount];
wcp center;
int round(float a)
{
int b;
b=a;
if(a-b>0.5)
return ++b;
else
return b;
}
void polyline(int x, wcp *y)
{
for(int i=0;i<x-l ;i++)
line(y[i].x,y[i].y,y[i+l ].x,y[i+l ].y);
}
void getlab(int x)
{
switch(x)
{
case 0:
{
strcpy(getlabel,"JAN");
break;
}
case 1:
{
strcpy(getlab ,"FEB");
break;
}
case 2:
{
strcpy(getlabel," MAR");
break;
}
case 3:
{
strcpy(getlabel,"APR");
break;
}
case 4:
{
strcpy(getlabel,"MAY");
break;
}
case 5:
{
strcpy(getlabel,"JUN");
break;
}
case 6:
{
strcpy(getlabel,"JUL");
break;
}
case 7:
{
strcpy(getlabel,"AUG" );
break;
}
case 8:
{
strcpy(getlabel,"SEP");
break;
}
case 9:
{
strcpy(getlabel,"OCT");
break;
}
case 10:
{
strcpy(getlabel,"NOV");
break;
}
case 11:
{
strcpy(getlabel,"DEC");
break;
}
}
}
void getdata()
{
float t1=0.00,t2;
for(int t=0;t<12;t++)
getlab(t);
printf("ENTER THE DATA FOR THE MONTH OF %s: ",getlabel);
scanf("%f",&data.realarray[t]);
if(data.realarray(t)>tl )
{
t1=data.realarray[t];
}
for(t=0;t<12;t++)
{
t2=data.realarray[t]/t 1;
data.array[t]=t2*400;
}
}
void puttext(wcp textp)
{
settextstyle(1,HORIZ_DIR,1);
outtextxy(textp.x,textp.y,getlabel);
}
void drawlabels()
{
wcp textposition;
textposition.y=chartbottom;
int zz=25;
for(int az=0;az<12;az++)
{
textposition.x=zz;
zz+=50;
getlab(az);
puttext(textposition);
}
}
char valuep[5];
void findvaluep(int x)
{
int y=x,ttt;
char tg[5];
strcpy(tg,"");
do
{
ttt=y%10;
switch(ttt)
{
case 0:
{
strcat(tg,"0");
break;
}
case 1:
{
strcat(tg,"1");
break;
}
case 2:
{
strcat(tg,"2");
break;
}
case 3:
{
strcat(tg,"3");
break;
}
case 4:
{
strcat(tg,"4");
break;
}
case 5:
{
strcat(tg,"5");
break;
}
case 6:
{
strcat(tg,"6");
break;
}
case 7:
{
strcat(tg,"7");
break;
}
case 8:
{
strcat(tg,"8");
break;
}
case 9:
{
strcat(tg,"9");
break;
}
y/=10;
} while(y>0);
strcpy(valuep,"");
for(y=0;y<strlen(tg);y++)
{
valuep[y]=tg[strlen(tg)-y-1];
}
valuep[y]=NULL;
}
}
void linechart()
{
drawlabels();
settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
for(int t=0;t<monthcount;t++)
{
coord[t].x=monthplace[t];
coord[t].y=450-data.array[t]-dataoffset;
findvaluep(data.realarray[t]);
outtextxy(coord .x,coord[t].y-l0,valuep);
}
polyline(monthcount,coord);
}
void main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
getdata();
cleardevice();
chartbottom=450.0;
interval=50.0;
monthplace[0]=25;
for(int z=1;z<monthcount;z++)
monthplace[z]=monthplace[z-1 ]+interval;
linechart();
getch();
cleardevice();
closegraph();
}
OUTPUT
RESULT:
Thus the program to implement to show the Line Chart
is compiled and executed successful
Exp no –
Date -
Logo Creation
Aim: -
To create a logo using various tools of Adobe
Photoshop 7.0
Algorithm: -
Result: -
The logo has been created successfully.
Exp –
Date –
Displacement Effect
Aim: -
To create a flag using displacement effect.
Algorithm: -
Step 1: Select a grid in gradient tool with 3 colour slides.
Step 2: Set the desired colours.
Step 3: Use gradient to create a gradient of three layers.
Step 4: Create a new document.
Step 5: Create another gradient with many alternate slides
of two colours.
Step 6: Use it to create a pattern in new file.
Step 7: Select the new file’s contents and drag it to the
first one.
Step 8: Set overlay in the layer properties.
Step 9: Merge the layers.
Step 10: Save and Exit.
Output
Result: -
The flag has been created successfully using
displacement effect.
Exp –
Date –
Animation Effect
Aim: -
To create animation effect in simple JPG file using
tween and liquefy effect.
Algorithm: -
Original: Animated:
Result: -
The program is written and executed successfully.
Expt no:
Date :
MIRROR IMAGE
Aim
To use Adobe Photoshop CS 9 to make a
mirror image of a given picture.
Steps
Steps
1. Open the image you want to modify
2. Use the Liquify ( Filter Liquify or press
Shift + Ctrl + X )
3. Use various tools on the Liquify window to
alter the person’s face. The various available
tools are
Warp Tool
Wave Tool
Swirl Tool
Shrink Tool
Expand Tool
Move Left Tool
Mirror Tool
Undo Tool
Initial Picture :
Final Picture :