C++ creating image -


I have not been programming in C ++ for a while, and now I have to write a simple thing, but this I'm driving crazy

I need to create a bitmap from a table of colors: four images [200] [200] [3];

First coordinate width, second height, third color: RGB How to do this?

Thanks for any help, Adam

I'm sure you already Checked.

With that information we can write a quick BMP in hand:

  // setup header structs bmpfile_header and bmp_dib_v3_header before (see wiki) // * note a If you want to have a negative height for window bitmap if you 're starting from above * / * otherwise the image data is expected to go below * FILE * fp = fopen ("file.bmp", "wb") is; Filitt (bmpfile_header, sizef (bmpfile_header), 1, fp); FILIT (bmp_dib_v3_header, sizeof (bmp_dib_v3_header_t), 1, FP); For (Int i = 0; i <200; i ++) {for (J. J.L.;; J & LT; 200; J ++) {EFrite (and image [J] [I] [2] ], 1, 1, FP); Filitt (and image [ja] [i] [1], 1, 1, fp); Filitt (and image [J] [i] [0], 1, 1, FP); }} Fclose (fp);  

If setting up a header is a problem, then let us know.

Edit: I forgot, BMP files expect BGR instead of RGB, I have updated the code (I wonder if someone has not caught it.)

< / Html>

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -