Need Help!

Status
Not open for further replies.

vijayrock

Right off the assembly line
I need C code 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...

i executed this program using TURBO C++ 3.0 IDE..i got the output but i am not able to use the print screen option to capture the output(DOS window..a black one)...i need the output to printed...

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);
}
}
 
Status
Not open for further replies.
Top