![]() |
| | #1 |
| Registered User Join Date: Jul 2008
Posts: 2
| |
| aaron08 is offline | |
| | #2 |
| Wheres the lesbians? Join Date: Oct 2006 Location: UK
Posts: 1,219
| use fopen to open the file. If you want to read as well as write use "r+b" as the second parameter. You can then use fseek to get where you want in the file. If you are writing multibyte data then I think you will also want to cast it to a character array before writing, and you may need to reverse it when reading IIRC.
__________________ Senior highbrow doctor of authority. |
| mike_g is offline | |
| | #3 |
| Registered User Join Date: May 2008
Posts: 53
| It depends in what format the bitmap file is. Many image formats can be read/written with freely available libraries (libjpeg, libpng, libtiff); other formats are relatively simple and can be decoded and encoded "manually". I don't understand your remark about a header file. -- Computer Programming: An Introduction for the Scientifically Inclined |
| Sander is offline | |
| | #4 |
| Registered User Join Date: Jul 2008
Posts: 2
| what i know is that each bitmap file has a file header which contains the size of the image, the bits per pixel etc. |
| aaron08 is offline | |
| | #5 |
| and the hat of vanishing Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,214
| http://en.wikipedia.org/wiki/BMP_file_format "draw" your line in a large array of pixels, then write them out the file.
__________________ If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut. Up to 8Mb PlusNet broadband from only £5.99 a month! |
| Salem is offline | |
| | #6 |
| Registered User Join Date: Oct 2001
Posts: 2,110
| a header file is source code. (stdio.h, stdlib.h, etc) a file header is data that goes before other data in a file. |
| robwhit is offline | |
| | #7 | |
| Registered User Join Date: May 2008
Posts: 53
| Quote:
-- Computer Programming: An Introduction for the Scientifically Inclined | |
| Sander is offline | |
| | #8 |
| Wheres the lesbians? Join Date: Oct 2006 Location: UK
Posts: 1,219
| Yeah, but GIF, JPEG, TIFF and PNG are not bitmaps. Bitmaps should have "BM" (edit: in ASCII) as the first two bytes in the header. Palleted bitmaps can complicate things tho.
__________________ Senior highbrow doctor of authority. Last edited by mike_g; 07-28-2008 at 04:40 PM. |
| mike_g is offline | |
| | #9 |
| Registered User Join Date: May 2008
Posts: 53
| That depends on what your definition of "bitmap" is. If you mean "the contents of a BMP file" then you are right. But you could also mean "a rectangular array of pixel values" (as opposed to a "vector image"). It wasn't clear to me from the original poster what he meant. |
| Sander is offline | |
![]() |
| Tags |
| bitmap, graphing |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Loading a bitmap (Without using glaux) | Shamino | Game Programming | 7 | 03-16-2006 09:43 AM |
| OpenGL -- Bitmaps | HQSneaker | Game Programming | 14 | 09-06-2004 04:04 PM |
| Loading a Bitmap resource for OpenGL Texture[x] | the dead tree | Game Programming | 4 | 08-26-2004 01:12 PM |
| bitmap not going onto screen | stallion | Windows Programming | 4 | 02-22-2003 10:07 AM |
| texture is all white in opengl! | Crossbow | Game Programming | 7 | 03-31-2002 11:54 AM |