I need C code or program to save the output of the following program into a jpg file(any picture file)?
i need to save the output of this program in to a picture file..i need to take printouts of those output..help me with the code that does the above thing...
this program is just a program to draw straight line using DDA algorithm
#include<graphics.h>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<dos.h>
#define ROUND(a)((int)(a+0.5))
void dda(int,int,int,int);
void main()
{
int gdriver=DETECT,gmode;
int x1,y1,x2,y2;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi...
printf("Enter the starting and ending coordinates of line:");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
dda(x1,y1,x2,y2);
getch();
}
void dda(int xa,int ya,int xb,int yb)
{
int dx,dy,steps,k;
float xinc,yinc,x,y;
dx=xb-xa;
dy=yb-ya;
if(abs(dx)>abs(dy))
steps=abs(dx);
else
steps=abs(dy);
xinc=dx/(float)steps;
yinc=dy/(float)steps;
x=xa;
y=ya;
putpixel(ROUND(x),ROUND(y),1);
for(k=1;k<=steps;k++)
{
x=x+xinc;
y=y+yinc;
delay(10);
putpixel(ROUND(x),ROUND(y),1);
}
}