| | |
need C program help
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 9
Reputation:
Solved Threads: 0
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
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
c Syntax (Toggle Plain Text)
#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); } }
Last edited by Ancient Dragon; Apr 5th, 2008 at 9:44 pm. Reason: add code tags
•
•
Join Date: Sep 2006
Posts: 327
Reputation:
Solved Threads: 22
I think you might be looking for this function
http://www.cs.colorado.edu/~main/cs1.../getimage.html
See this too.
http://www.geocities.com/SiliconVall.../pasl2007.html
http://www.cs.colorado.edu/~main/cs1.../getimage.html
See this too.
http://www.geocities.com/SiliconVall.../pasl2007.html
You have to use TurboC or TurboC++ compilers to use either of those links. graphics.h is obsolete and not supported by all other compilers.
I don't really know the answer to the question but I think it will be pretty complicated. Here is the jpg file format and here are other possible google links that may be useful.
I don't really know the answer to the question but I think it will be pretty complicated. Here is the jpg file format and here are other possible google links that may be useful.
Last edited by Ancient Dragon; Apr 5th, 2008 at 10:29 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
I think you must choose .bmp file instead of jpg, as jpg files are difficiult to read and hence write. On the other hand .bmp files are easy to read and write. But they take much more strorage as compared to jpg files (no compression in .bmp files). you should go for 4-bits .bmp file. I can tell you its all about the header of bmp file, onces you understand the header its easy to read and write the file.
Best of luck
Best of luck
•
•
Join Date: Feb 2008
Posts: 9
Reputation:
Solved Threads: 0
http://www.cs.colorado.edu/~main/cs1.../getimage.html
this link was very useful
the thing is where do the image gets stored....that is the location...
this link was very useful
the thing is where do the image gets stored....that is the location...
![]() |
Similar Threads
- Playing .Wav/MIDI files in a Visual Basic Program (Visual Basic 4 / 5 / 6)
- What's the HARDEST program you've written? (Computer Science)
- Cool little Program to disable startup programs (Windows NT / 2000 / XP)
- Program is shutting down right after program is executed (C++)
- 3d Program (Game Development)
Other Threads in the C Forum
- Previous Thread: need help with c
- Next Thread: Insertion sort with files
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays asterisks binarysearch calculate changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic execv feet fgets file fork forloop framework function givemetehcodez grade graphics gtkwinlinux hacking histogram homework inches include incrementoperators input intmain() iso kernel keyboard km lazy license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft motherboard mqqueue number oddnumber odf opendocumentformat opensource overwrite owf pdf performance pointer posix problem probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket socketprograming spoonfeeding standard string student systemcall testing threads turboc unix user variable wab whythiscodecausesegmentationfault windowsapi






