SRL Archive - Research & Development Lounge

RGB.scar - Work In Progress


pwnaz0r

2007-08-17 22:53:00

RGB.scar - A Work in Progress



Helpful Links and Scripts Using RGB.scar:

Updates:
  • 8/14/2007 - Project Started
  • 8/17/2007 - Project Beta Released
  • 8/17/2007 - RGB Variable better Utilized
  • 8/18/2007 - FindClosestRGB Released
  • 8/18/2007 - FindRGBTolerance Released / RGB Variabel ReVamped

About The Project:

Well in an effort to promote the use of RGB and to inform scripters of its great uses, I have decided to at least start on the project of bringing RGB colorfinding into the SRL include. The initial beta version only includes the creation of the RGB variable and a few RGB functions that may prove useful. I have only set out the tools, now you, the scripters can use them :).

RGB is useful for many things but the thing I personally believe it to be best for it Autocoloring and Finding tolerance faster.

Goals -
  • Moderately Increase AutoColoring Techniques [X]
  • Increase Color Tolerance Finding Techniques [X]
  • Finding the center of Colors, such as trees [ ]
  • RGB Variable [X]
More to come…

What it Includes
  • RGB Variable
  • CreateRGB
  • CompareColorsRGBEx
  • CompareColorsRGB
  • CompareColorArrayRGB
  • AutoColorMM
  • MinArray
  • FindClosestRGB
  • ConvertRGB
  • FindRGBTolerance

To find out how these procedures and functions work, please refer to the tutorial at the top.

Things to be added:
  • Experemental Colorfinding
  • This is one of my favorites. Its something I thought of while thinking of ways to speed up the colorfinding. It looks great and it will soon be released!
  • RGB Component Creator
  • This is on its way also. Will be just like RadialWalk Helper, etc.
  • Much More!

RAM

2007-08-17 22:55:25

Very Interesting :)…..Have you considered creating a plugin to improve efficiency and increase speed ?

pwnaz0r

2007-08-17 22:58:50

Ha. Well its not at all an attempt to get into SRL but at least it will possibly spark some interest in RGB. I use RGB quite often in scripting and it is very useful for me. I am not near finished with some of my functions that I am working on so hopefully it will be bigger. Also I'm hoping that alot of people will contribute.

And Yes. I am currently in the process of making one.

dvdcrayola

2007-08-18 04:09:36

i am very interested in this.. i will be reading the tutorial and coming back when you add more :D

Killerdou

2007-08-18 04:12:44

im willing to make the plugin if needed:)

pwnaz0r

2007-08-18 11:48:46

Ok cool I loveit I'll message you right away ;).

R0b0t1

2007-08-18 13:40:26

You've inspired me… I'm going to try to make an HSL or CMYK (if scar supports it) include.


When I start making it, we could work together to create some of the fuctions.

pwnaz0r

2007-08-18 16:35:38

Yeah that sounds good. I have been wondering if I or someone should do HSL.scar. Anyways add me on msn ( in my sig ).

EDIT : Updated. Now includes an extremely fast (For RGB) colorfinding with Tolerance finder.

dvdcrayola

2007-08-18 16:40:28

wow… you just keep coming and coming.. a hit tutorial and an include all in like 2 days?!?!?!

NICE haha.

im liking this stuff. i am going to look at it closely later and try to learn from it.

pwnaz0r

2007-08-18 16:50:50

Ha yeah. I haven't been here since about Febuary and I decided that I should make up for lost time ;).

ShowerThoughts

2007-08-18 17:05:15

nicve work

R0b0t1

2007-08-18 17:06:19

Lol. Well, HSL is coming along nicely. Thing is, I haven't found any way to convert Color32 (IE. Color mod 256) to HSL :p. Poor me…


Nice job on most of the functions, once you're more finished I would try putting it in the SRL new functions forum.

pwnaz0r

2007-08-18 17:07:59

From: hermpie
nicve work


Thnx ;)

From: r0b0t1
Lol. Well, HSL is coming along nicely. Thing is, I haven't found any way to convert Color32 (IE. Color mod 256) to HSL :p. Poor me…


Nice job on most of the functions, once you're more finished I would try putting it in the SRL new functions forum.


K Get Ill pm you about it ;).

R0b0t1

2007-08-18 17:09:51

You respond fast.

Well, I found the stuff to convert from RGB on wikipedia… But I'll get on anyway. I forgot what part of it meant.

pwnaz0r

2007-08-19 13:17:21

500th post woot. Alright

n3ss3s

2007-08-19 13:31:02

Lookey what I've got for ya if you want! :p

function FindRGBCircleTol(var RgX, RgY: Integer; R, G, B, MidX, MidY, Dist, Tol:
Integer): Boolean;
var
C: Integer;
begin
C := RGBToColor(R, G, B);
Result := FindColorCircleTolerance(RgX, RgY, C, MidX, MidY, Dist, Tol);
end;

Nothing big, but noticed you didnt have finding from circle.

Bobarkinator

2007-08-19 14:01:43

Lol n3ss3s you forgot to add in a param on the RGBtoColor for the color spot.

n3ss3s

2007-08-19 14:05:04

Lol, there isnt it returns the integer. And it compiles I tested.

Oh and pwn heres another

function GetClosest(RGB: string; ClosestTo, x1, y1, x2, y2, MaxAdd: Integer): Integer;
var
I, C1, C2, R, G, B, TempC, x, y: Integer;
var
TempB: Boolean;
begin
Result := 0;
ColorToRGB(ClosestTo, R, G, B);
for I := 1 to 2 do // 1 = Up, 2 = Down
begin
repeat
case RGB of
'R': begin
case I of
1: begin
TempC := RGBToColor(R, G, B);
if(not(FindColor(x, y, TempC, x1, y1, x2, y2)))then
begin
Inc(R);
end;
end;
2: begin
TempC := RGBToColor(R, G, B);
if(not(FindColor(x, y, TempC, x1, y1, x2, y2)))then
begin
Dec(R);
end;
end;
end;

'G': begin
case I of
1: begin
TempC := RGBToColor(R, G, B);
if(not(FindColor(x, y, TempC, x1, y1, x2, y2)))then
begin
Inc(G);
end;
end;
2: begin
TempC := RGBToColor(R, G, B);
if(not(FindColor(x, y, TempC, x1, y1, x2, y2)))then
begin
Dec(G);
end;
end;
end;

'B': begin
case I of
1: begin
TempC := RGBToColor(R, G, B);
if(not(FindColor(x, y, TempC, x1, y1, x2, y2)))then
begin
Inc(B);
end;
end;
2: begin
TempC := RGBToColor(R, G, B);
if(not(FindColor(x, y, TempC, x1, y1, x2, y2)))then
begin
Dec(B);
end;
end;
end;
end;

Its not ready, but the meaning of it is to return the closest R, G, or B to the R, G or B of the ClosestTo TColor's RGBs

You can create your own of it if you need or something…

R0b0t1

2007-08-19 22:10:32


Function FindRGBTriangleTol(var RgX, RgY: Integer; R, G, B, X1, Y1, X2, Y2, X3, Y3, Tol): Boolean;
Var Col: Integer;
begin;
Col:= RGBToColor(R, G, B);
Result:= FindColorTriangleTolerance(RgX, RgY, Col, X1, Y1, X2, Y2, X3, Y3, Tol);
end;


Lol. Start making the skips.

pwnaz0r

2007-08-19 23:03:44

Yup ;). Anyways whenever I have time I will add these functions. School is starting and I'm not allowed to get on SRL during the week (for now). Anyways updated with a link to one of the scripts using RGB.scar. It has it included and I think it shows how well RGB can be used ;).

Kik

2007-08-23 17:32:49

Hey, this is probably going to sound like a stupid question, but what is RGB (Red Green Blue), and what is it used for?

R0b0t1

2007-08-23 18:22:04

It is a color space.

Well, it's just a way of defining colors, almost like SCAR's colors (Color32). But to use it you usually must go RGBToColor().