Sunday, April 4, 2010

The order of the ' void *inData ' in...

We want to get the image data in filter plug-in.

the code is like this:

-------------------------------------------

FILE *fp;

fp=fopen(''C:\\h.bmp'',''w+r'');

fseek(fp, 55, SEEK_SET);

fwrite((unsigned char*)gStuff-%26gt;inData, 1, gStuff-%26gt;bigDocumentData-%26gt; wholeSize32.v * gStuff-%26gt;bigDocumentData-%26gt;wholeSize32.h * gStuff-%26gt;planes, fp);

fclose(fp);



-------------------------------------------

Why the image data saved is disordered?

Thanks.
The order of the ' void *inData ' in...
%26gt;fp=fopen(''C:\\h.bmp'',''w+r'');

%26gt;Why the image data saved is disordered?



It's not. But BMP files have different rules and orders for pixel data

than the Photoshop data. Read the specification for both carefully,

you will need to convert each pixel and ALSO may need to do special

processing at the end of each scan line.



Aandi Inston
The order of the ' void *inData ' in...
Thank Aandi Inston.

Could you tell me how to convert each pixel data to BMP files?

%26gt;Could you tell me how to convert each pixel data to BMP files?



It should be obvious once you have studied both specifications. You

seem to be making assumptions that pixel data is universal, rather

than specific to each file format.





Aandi Inston

Note that some sources on the web incorrectly state that the byte

order in a 24-bit BMP file is Red, Green, Blue; in fact it is Blue,

Green, Red. This file seems accurate:

http://atlc.sourceforge.net/bmp.html



Aandi Inston

On the other hand,

http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html

includes vital information missing in the other reference. This is

more accessible and the section ''The pixel data'' is vital. However,

when it says ''The first byte represents the red part, the second the

green and the third the blue part'', this is simply wrong. Caveat

emptor.



Aandi Inston

http://msdn2.microsoft.com/en-us/library/ms532311.aspx

Thank Aandi Inston and Toby Thain.

The problem is solved.

No comments:

Post a Comment