[lazarus] Wrong colours in win32
Micha Nelissen
M.Nelissen at student.tue.nl
Thu Nov 27 15:33:57 EST 2003
Mattias Gaertner wrote:
> On Thu, 27 Nov 2003 17:17:50 +0100 Micha Nelissen
> <M.Nelissen at student.tue.nl> wrote:
>
>
>>Hi,
>>
>>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.
>
>
> I guess, it has something to do with the calculation of the bit offset in
> intfgraphics.pp. Someone changed this a few weeks ago and I didn't notice it
> till yesterday, that this broke the gtk side.
That someone was me ;-).
> Probably it is related to the "Byte Order" misunderstanding.
> As I said, I didn't implemented it yet, because I hoped, that it is solely
> processor dependent and we do not yet support powerpc.
> But it seems that even win32 and X do not use the same byte/bit order for
> images. So, we have to implement it now.
Monochrome (and 4-bit) images have their pixels from high to low in
win32. So bit 7 is pixel 0, bit 0 is pixel 7. I assume something similar
holds for 4-bit images.
> That means a further IF in the Get/SetPixel function, which is a very time
> critical function. I suggest to implement one all rounder function plus
> several optimized functions for commong formats. The Get/SetPixel then uses
> an event.
Good idea.
> ToDo:
> - first you have to find out the byte and bit order under win32. (Draw some
> very simple images (5x5, 8x8, 13x13, 18x18, 26x26 and 34x34) with a few
> lines.
For monochrome images, I explained above. I believe there is no problem
with byte order. Byte order is parameterized already anyway.
> - fix the Get/SetPixel code (with some IFDEFs).
Okay will do.
> - you have to try 15/16/24/32 bit depths of the window dektop.
> - then we can add the missing BitOrder/ByteOrder to the TRawImageDescription
We'll need a bitorder I guess.
> - then we can implement the all rounder functions.
> - then we add the optimized functions.
>
> I hope, this was clear. If not, just mail.
Very clear :-). I'll try some coding, commit and report here, then you
can take a look.
Micha.
More information about the Lazarus
mailing list