[fpc-devel] proposal for palette-related graph unit interface changes
Nikolay Nikolov
nickysn at users.sourceforge.net
Wed Sep 15 16:39:42 CEST 2010
Currently, the following palette-related things from the fpc graph
unit aren't TP7 compatible:
MaxColors (constant)
PaletteType (record)
procedure SetAllPalette(const Palette: PaletteType);
procedure GetPalette(var Palette: PaletteType);
function GetPaletteSize: smallint;
procedure GetDefaultPalette(var Palette: PaletteType);
the most notable difference is the definition of PaletteType, which is
defined as:
in fpc:
const
MaxColors = 255;
type
RGBRec = packed record
Red, Green, Blue: smallint;
end;
PaletteType = record
Size: longint;
Colors: array [0..MaxColors] of RGBRec;
end;
in TP7:
const
MaxColors = 15;
type
PaletteType = record
Size: byte;
Colors: array [0..MaxColors] of shortint;
end;
so the main difference is that fpc's PaletteType represents a VGA 256 to
RGB colour palette, while TP7's represents EGA's 16->64 palette. My
proposal is to rename:
MaxColor -> RGBPaletteMaxColor
PaletteType -> RGBPaletteType
SetAllPalette -> SetAllRGBPalette
GetPalette -> GetAllRGBPalette
GetDefaultPalette -> GetDefaultRGBPalette
GetPaletteSize -> GetRGBPaletteSize (this one might be unnecessary -
will have to check if GetPaletteSize already returns the same values as
TP7; we might still introduce GetRGBPaletteSize for consistency with the
other RGBPalette procedures/functions, though)
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?
More information about the fpc-devel
mailing list