SRL Archive - Help and Support

Color Help


king vash

2008-03-08 03:52:47

I'm Finding the Interal Alter Cliff Colr (I call if RuneCliff Color)

I have 100 logged colors and i'm looking to refine my color finding loop
function FindRuneCliffColor: Integer;   //Uses Tarajunky's basic autocolor format
var
GC, a, l, TColor, Red, Green, Blue : integer;
P:array of Tpoint;
begin
Flag;
GC := 4484727;
FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 45);
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
if rs_OnMinimap(P[a].x,P[a].y) then
begin
TColor := GetColor(P[a].x,P[a].y);
if SimilarColors(TColor,GC,45) then
begin //add a bunch more check condition and debug this
ColortoRGB(TColor,Red,Green,Blue);
if ((Red >= 90) and (Red <= 150)) then
if ((Green >= 75) and (Green <= 140)) then
if ((Blue >= 40) and (Blue <= 90)) then
if ((Red >= Green) and (Green >= Blue)) then
if (((Red - Green) > 27) and ((Red - Blue) > 62)) then
if ((Green - Blue) > 56) then
if ((GetColor(P[a].x + 20, P[a].y ) = TColor) and (GetColor(P[a].x, P[a].y + 20) = TColor)) then
if ((GetColor(P[a].x + 15, P[a].y) = TColor) and (GetColor(P[a].x, P[a].y + 15) = TColor)) then
if ((GetColor(P[a].x + 10, P[a].y) = TColor) and (GetColor(P[a].x, P[a].y + 10) = TColor)) then
if ((GetColor(P[a].x + 20, P[a].y + 20) = TColor) and (GetColor(P[a].x + 10, P[a].y + 10) = TColor)) then
begin
Result := TColor;
WriteLn('RuneCliff Color = ' + IntToStr(TColor));
Exit;
end;
end;
end;
end;
Result := 0;
end;

it has 3700 possible colors that will are acceptable. I think this is higher than it could be so i'm trying to improve it. is their a way to use Hue, Saturation and Luminance, to refine selectable colors more

Negaal

2008-03-08 05:08:46

Yes there is, ColorToHSL(Color,H,S,L);, you need to know max and min ranges of sat, hue and luminance, also, hint, you don't need similarcolors(), and instead e.g "if ((Blue >= 40) and (Blue <= 90)) then" you can do "if InRange(Blue, 40, 90) then"

ZephyrsFury

2008-03-08 05:09:20

Yes you can use RGB, HSL, XYZ to filter colours. Do the same thing to HSL as you're doing to RGB. ie:


ColorToHSL(Colour, H, S, L);
if (H >= 5) then if (H <= 10) then
//etc...

EDIT: Like Negaal said :p

nielsie95

2008-03-08 11:14:04

Use ACA v2 based on cts 2 with RGB and XYZ range checking.

king vash

2008-03-09 04:40:00

From: nielsie95
Use ACA v2 based on cts 2 with RGB and XYZ range checking.


so confused as to what that means

ZephyrsFury

2008-03-09 05:23:59

From: king vash
so confused as to what that means


Use nielsie and Sum's new AutoColourAid( (ACA) Version 2. Enter your list of colours. Change Color Tolerance Speed to 2. Use the function created by ACA or copy the list of max and min RGB, HSL, XYZ into your own function.

king vash

2008-03-09 14:43:32

program New;
var
Count, Tcolor : Integer;
Red,Green,Blue : integer;
Hue,Sat,Lum : Extended;
XC,YC,ZC : Extended;
begin
Count := 0;
TColor := 0; //comment line 7 and line 23 if you want to check a single color
wait(1000)
for TColor := 0 to (255*255*255+1) do
begin
ColortoRGB(Tcolor,Red,Green,Blue); //add a bunch more check condition and debug this
ColortoHSL(Tcolor,Hue,Sat,Lum);
ColortoXYZ(Tcolor,XC,YC,ZC);
// writeln('red ' + inttostr(red) + ' + green ' + inttostr(green) + ' + blue ' + inttostr(blue)
// + ' + Hue ' + FloatToStr(Hue) + ' + Sat ' + FloatToStr(Sat) + ' + Lum ' + FloatToStr(Lum)
// + ' + X ' + FloatToStr(XC) + ' + Y ' + FloatToStr(YC) + ' + Z ' + FloatToStr(ZC));
if (InRange(Red,90,150) and InRange(Green,80,140) and InRange(Blue,45,90)) then //Red Green Blue inrange
if (InRange(Round(Hue),9,16) and InRange(Round(Sat),26,33) and InRange(Round(Lum),29,44)) then //Hue Sat Lum inrange
if (InRange(Round(XC),9,22) and InRange(Round(YC),9,24) and InRange(Round(ZC),4,12)) then //X Y Z inrange
if (InRange((Red - Green),5,26) and InRange((Red - Blue),47,61) and InRange((Green-Blue),26,55)) //R-G R-B G-B in Range
then Count := Count + 1;
end;
writeln(IntToStr(Count) + ' colors pass the test');
end.

with the color list
Colors := [4152942, 4152942, 4152942, 4153966, 4152942, 4220017, 4352884, 4221297, 4353908, 4484727,
4551034, 4352884, 4352884, 4352884, 4351860, 4351860, 4220017, 4350836, 4218993, 4350836,
4218993, 4351860, 4350836, 4350836, 4351860, 4154990, 4153966, 4220017, 4152942, 4151662,
4151662, 4217969, 4349556, 4217969, 4349556, 4482423, 4679037, 4679037, 4547450, 4481399,
4679037, 4680317, 4876932, 4876932, 5008518, 4876932, 5074825, 5008518, 4879492, 5011334,
5076105, 5074825, 5074825, 5074825, 5207691, 5207691, 5277581, 4876932, 4947844, 4683134,
4681854, 4615804, 4613243, 4219250, 4217970, 4086383, 4021100, 3364708, 5014151, 5343373,
4283506,5342093,4285552,5277581];

my color list is bad and i need to collect some new ones. is their any way other than just enter and exitting the alter and logging in and out to do this?

R0b0t1

2008-03-10 18:59:11

Using tolerance, perhaps?


Just bubble sort that array and find the difference of the max and min of the color system you wish.