writing a BMP file
Posted: Thu Jun 26, 2008 1:24 am
is there any examples of how to write a bmp file out to disk ?
I understand how they are read, and I can open them and manipulate the pixel data and display it on screen no problems , but i am at a loss on how to export the changed data, especially if i changed the SIZE of the bmp.. ( i can do the data part, it is the header that is confusing)
I am working on this..
based on game a gogos/pyrometals rotation code
so far ,
1. I can open up ANY sized 24 bit bitmap (in multiples of four) and the program automatically adjusts for size
(I know how to solve the multiples of four problem.. just haven't got to that point yet.)
2. the program reads the first pixel and turns all others of the same color to "transparent" and then fills in the corners created by each the rotation with the same color.. it will also enlarge the bitmap area to encompass complete rotations without cropping
3. loads by filename prompt and error checks if exist - note: can load from other directories as long as you know the path
4. then rotates image as many times as asked, and assembles a spritesheet in a bitmap ready array (pixel data array)
I only need to know how to finish writing it out ie: how to do the BMP header ! I can do the data part OK..
thanks in advance
feral
I understand how they are read, and I can open them and manipulate the pixel data and display it on screen no problems , but i am at a loss on how to export the changed data, especially if i changed the SIZE of the bmp.. ( i can do the data part, it is the header that is confusing)
I am working on this..
based on game a gogos/pyrometals rotation code
so far ,
1. I can open up ANY sized 24 bit bitmap (in multiples of four) and the program automatically adjusts for size
(I know how to solve the multiples of four problem.. just haven't got to that point yet.)
2. the program reads the first pixel and turns all others of the same color to "transparent" and then fills in the corners created by each the rotation with the same color.. it will also enlarge the bitmap area to encompass complete rotations without cropping
3. loads by filename prompt and error checks if exist - note: can load from other directories as long as you know the path
4. then rotates image as many times as asked, and assembles a spritesheet in a bitmap ready array (pixel data array)
I only need to know how to finish writing it out ie: how to do the BMP header ! I can do the data part OK..
thanks in advance
feral