Solved it!


2004-05-14 08:01:13 PM
delphi19
Sorry! Solved it..
I must have been tired last night.. spotted it now.
There was a..ehem.. error in my code that broke with compression.
Jon Lennart Aasenden
"Jon Lennart Aasenden" <XXXX@XXXXX.COM>writes
Quote
Hello again (and again..).

Ok, perhaps someone here can clear this up for me.

I have added support for 15 and 16bpp to my graphics library (no API calls
used, everything is native delphi).

15Bit is ofcourse defined as 555 (r=5bits..etc), while 16bit is defined as
565.

While this works perfectly with the displaying of graphics (as it should),
im having a hard time coding a bitmap loader that distinguish between
these
modes!

Turns out that photoshop saves it is 16bit images in 555 mode, and 15bit
images in 565 mode! The exact opposite of how the data is represented in
memory.

Also, the 15bit modes have a different value in the bitmapinfo header.
All bitmaps have the value 80 in the InfoHeader.biSize property, but 15bit
images (saved with photoshop) have the value 56.

Is this an indication value that 565 encoding is used? Is it supported
officially? Is there any documentation online about loading bitmaps
directly? I have been at this problem now for 2 days! 2 days!

Also, the BitmapFileHeader.bfOffBits does not match up to the offset value
i
get after parsing the file. It is correct, but there seems to be
2xlongword
added to the file (before the raw pixel data).

Normally, SizeOf(TBitmapFileHeader) + SizeOf(TBitmapInfoheader) should
equal
BitmapFileHeader.bfOffBits. It works with all other modes (except palette
modes naturally) besides 15bit.

Does photoshop save a decoding mask with 15bit images?
What can those two longwords be?

Help!

Jon Lennart Aasenden