On 09/15/2010 05:45 PM, Jonas Maebe wrote:

On 15 Sep 2010, at 16:39, Nikolay Nikolov wrote:

and then introduce TP7-compatible MaxColors, PaletteType and procedures/functions. They'll be made optionally hookable (so the go32v2 implementation will be able to implement them with the real EGA palette registers for maximum compatibility), with a default implementation that works on top of SetRGBPalette (similar to the way SetPalette is implemented now)

What do you think?

How did the palette work in TP7 with the SVGA256 bgi driver?
Ok, I tested Jordan Hargraphix' SVGA256.BGI (the file header says: "SVGA256 BGI Device Driver (SVGA256) 3.2 - Aug 23, 1994 Copyright (c) 1990-94 by Jordan Hargraphix").

SetRGBPalette works like it should, e.g. SetRGBPalette(0, 63, 0, 0) modifies the background color to red.

GetPaletteSize returns 0.

GetPalette(var Palette: PaletteSize)
returns Palette.Size = 0 and Palette.Colors filled with (seemingly) random values: (0, 0, 0, 0, 0, 64, 1, 64, 1, -57, 0, 0, 0, 0, 0, 8). These values are always the same between different runs of the program, but change when going to a different 256-colour mode (e.g. these were from 320x200x256; in 640x480x256, they are different, but still nonsense)

GetDefaultPalette returns the exact same nonsense palette like GetPalette.

SetPalette does not have any visual effect, but the "palette registers" that you've modified are reflected in the palette, returned by GetPalette; e.g. if you do:

SetPalette(0, 5);

the displayed image doesn't change at all, but after that GetPalette returns:
Palette.Size = 0
Palette.Colors = (5, 0, 0, 0, 0, 64, 1, 64, 1, -57, 0, 0, 0, 0, 0, 8)

while GetDefaultPalette continues to return:
Palette.Size = 0
Palette.Colors = (0, 0, 0, 0, 0, 64, 1, 64, 1, -57, 0, 0, 0, 0, 0, 8)

SetAllPalette also doesn't modify the displayed colors, but still "records" the "modified" palette entries:

for example, if you call SetAllPalette with:

Palette.Size = 8;
Palette.Colors = (1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0)

then GetPalette returns:

Palette.Size = 0;
Palette.Colors = (1, 2, 3, 4, 5, 6, 7, 8, 1, -57, 0, 0, 0, 0, 0, 8)

So obviously SetAllPalette respects the .Size, but still does nothing to the actually displayed colours :)

To summarize, all the EGA palette functions seem to be meaningless in 256-colour modes. Only the RGB palette functions work, which in TP7's case is actually only one function: SetRGBPalette
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to