In der SDL Component Suite gibt es Funktionen zur Interpolation von
RGB Farben und zur Konversion zwischen HSI, CYMK und
RGB. Damit kannst du dann beliebige Farbskalen erzeugen:
http://www.lohninger.com/helpcsuite/..._sdlcolors.htm
Hier der Source-Code dazu:
Delphi-Quellcode:
(******************************************************************************)
function InterpolateColor (Cl1, Cl2: TColor; Level: double): TColor;
(******************************************************************************
ENTRY: Cl1 .... start color
Cl2 .... end color
Level ..... interpolation level (0..1)
EXIT: function returns mixed color which contains 100*Level percent of color1
and 100(1-Level) percent of color2
******************************************************************************)
var
r,g,b : integer;
C1Blue,
C1Green,
C1Red,
C2Blue,
C2Green,
C2Red : integer;
begin
if Level > 1
then
Level := 1;
if Level < 0
then
Level := 0;
C1Blue := (Cl1
and $00FF0000)
shr 16;
C1Green := (Cl1
and $0000FF00)
shr 8;
C1Red := Cl1
and $000000FF;
C2Blue := (Cl2
and $00FF0000)
shr 16;
C2Green := (Cl2
and $0000FF00)
shr 8;
C2Red := Cl2
and $000000FF;
b := trunc(C1Blue+Level*(C2Blue-C1Blue));
g := trunc(C1Green+Level*(C2Green-C1Green));
r := trunc(C1Red+Level*(C2Red-C1Red));
InterpolateColor := (
RGB (r,g,b)
and $00FFFFFF);
end;
[edit=sakura] [delphi]Tags Mfg, sakura[/edit]