Registriert seit: 17. Mai 2007
480 Beiträge
Delphi XE6 Professional
|
Re: Color mixer
17. Aug 2012, 14:35
Delphi-Quellcode:
var
RGB: array [0..2] of Byte;
HSL1, HSL2: array [0..2] of Integer;
H, S, L: Integer;
begin
// get values here
// Max* vars are = 256
H := Round((MaxHue / ARange) * AValue) * (HSL2[0] - HSL1[0]) shr 8 + HSL1[0];
S := Round((MaxSat / ARange) * AValue) * (HSL2[1] - HSL1[1]) shr 8 + HSL1[1];
L := Round((MaxLum / ARange) * AValue) * (HSL2[2] - HSL1[2]) shr 8 + HSL1[2];
/// set color here
end;
SetLength(A, Round(edtSteps.Value) + 2);
A[0] := Color1;
A[High(A)] := Color2;
N := 255 div (Round(edtSteps.Value) + 1);
X := 0;
Caption := IntToStr(N);
for I := 1 to High(A) - 1 do
begin
Inc(X, N);
A[I] := BlendColorsHueCW(Color1, Color2, Byte(X), 255);
end;
F1
Geändert von WojTec (17. Aug 2012 um 14:46 Uhr)
|
|
Zitat
|