Re: ColorsTooClose Routine
- From: "Alex Zencovich" <zencovich@xxxxxxxxxxxxx>
- Date: Mon, 28 May 2007 19:38:53 +0300
Somthing like that?
function IsRGBColorClose(Color1,Color2 : TColor) : boolean;
var
r1,r2,g1,g2,b1,b2 : byte;
c1,c2 : integer;
begin
c1 := ColorToRGB(Color1);
c2 := ColorToRGB(Color2);
r1 := C1 and $FF;
r2 := C2 and $FF;
g1 := (C1 and $FF00) shr 8;
g2 := (C2 and $FF00) shr 8;
b1 := (C1 and $FF0000) shr 16;
b2 := (C2 and $FF0000) shr 16;
if ((r1=r2) and (g1=g2)) or ((r1=r2) and (b1=b2)) or ((b1=b2) and (g1=g2))
then
Result := True
else
Result := False;
end;
Please note - I do not sure I understood what mean 'close' in your question.
If really close - check it third part difference is 1 like
if
((r1=r2) and (g1=g2) and (Abs(Integer(b2)-Integer(b1)) = 1)) or
((r1=r2) and (b1=b2) and (Abs(Integer(g2)-Integer(g1)) = 1)) or
((b1=b2) and (g1=g2) and (Abs(Integer(r2)-Integer(r1)) = 1)) then
Result := True
else
Result := False;
Alex
"Tiger" <tiger@xxxxxxxxxx> wrote in message
news:4659e474@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi, All
Is there any 3rd party routine out there that can check if 2 Color are
too close to eachother?
Thanks
Tiger
.
- References:
- ColorsTooClose Routine
- From: Tiger
- ColorsTooClose Routine
- Prev by Date: ANN: MicroOLAP PostgresDAC 2.3.9 released
- Next by Date: Re: ColorsTooClose Routine
- Previous by thread: ColorsTooClose Routine
- Next by thread: Re: ColorsTooClose Routine
- Index(es):
Relevant Pages
|