Hi!
About 1 year ago, I had this excellently working UNIT of bitmap-picture handling routines.
Today I wanted to use them again, but the result is crappy. I was wondering if this can have something to do with BLOCKWRITE-restrictions in the new version of FPC.
I have 2 routines for writing gridded variables to bitmap picture files:
- one that uses 1 byte per pixel (=256 colours)
Here the definition of the colours is written first, then all pixels are written as index to the defined palette.
This routine still works.
- and one that takes 3 bytes per colour. Each byte gives R, G or B. No palette is written.
This is the type of bmp that I want to use for combining pictures. This is the one that refuses to give anything decent today!
The relevant part of code is:
.........write the header .......
FOR j := 1 TO NGridY DO
BEGIN
FOR i := 1 TO NGridX DO
BEGIN........relate the gridded variable in this point to R, G and B values........
BLOCKWRITE(OutFile,PixelB,SIZEOF(PixelB));
BLOCKWRITE(OutFile,PixelG,SIZEOF(PixelG));
BLOCKWRITE(OutFile,PixelR,SIZEOF(PixelR));
END;{ Fill line with dummy-data, since .bmp requires N-bytes divisible by 4 points on 1 line }
NDum := 3*NGridX;
IF (((NDum ) MOD 4)0) THEN
BLOCKWRITE(OutFile,Pixel,SIZEOF(Pixel));
IF (((NDum + 1) MOD 4)0) THEN
BLOCKWRITE(OutFile,Pixel,SIZEOF(Pixel));
IF (((NDum + 2) MOD 4)0) THEN
BLOCKWRITE(OutFile,Pixel,SIZEOF(Pixel));
END;Could it be that with the new compiler (like I found out with FORTRAN...) BLOCKWRITE requires
a MINIMUM set of bytes to write for it to work? In my code each BLOCKWRITE writes only 1 byte.
I am using Version 1.0.10 2008/08/03 of the IDE on Windows XP (SP2) Compiler version 2.2.2, precompiled binary.
Suggestions welcome!
Thanks!
Arjan
____________________________________________________________________________
DISCLAIMER: http://www.rivm.nl/disclaimer.htm
