[lazarus] Wrong colours in win32

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Nov 29 12:38:20 EST 2003

On Sat, 29 Nov 2003 18:17:56 +0100  Micha Nelissen
<M.Nelissen at student.tue.nl> wrote:

> Micha Nelissen wrote:
> > Very recently colours are wrong on win32. It happens only when using 
> > -dUseFPImage. I think it has to do with recent "fpImage streaming fixed"
> > 
> > which I saw in the logs? AFAICS, no colour related things have changed 
> > in the win32 interface.
> Okay, the colours still aren't correct :-(. They are correct if I set my 
> desktop depth to 32 bit. At 16 bit it doesn't work. Don't know about 24 
> bit, my video card doesn't support that. Mattias, could you look into 24 
> to 16 bit conversion of images? I guess that has to do with it.

The 24 of the image is irrelevant. 
If the 16 bit writing does not work, then 
- either the win32 intf has set the wrong shift and prec values 
- or WriteRawImageBits in intfgraphics.pas for BitsPerPixel=16 has to change
lo and hi byte.

The 5 lines in WriteRawImageBits simply replace some bits of a word. 
If you think, that the win32 intf has set the right values then you can try
to replace
  TwoBytes:=(PByte(P)^ shl 8)+PByte(P)^;

The only way to make sure: I suggest you create a bitmap in 16 bit mode,
paint it red, then green, then blue and read the first word, to see how
windows manages colors.


More information about the Lazarus mailing list