Title: mixing colors
Question: e.g. you have an own color picker, and simply want the user let mix up two colors.
Answer:
the easiest way to get color c1 mixed with color c2 is to calulate the middle values of the rgb-values. i put it in a function so you simply can use it. but don't use this code if you need fast code! it's really slow...
{GetMixColor - start}
function GetMixColor (c1, c2: TColor): TColor;
begin
// calculating the middle of the red, blue and green values
// of the colors c1 and c2:
Result := RGB (
(GetRValue (c1) + GetRValue (c2)) div 2,
(GetGValue (c1) + GetGValue (c2)) div 2,
(GetBValue (c1) + GetBValue (c2)) div 2
);
end;
{GetMixColor - end}
that's it.
if you have an faster version of this (i know it's possible to be greatly faster) please post it!