Difference between revisions of "GetClosestColor"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function GetClosestColor(Color: Integer; Colors: TIntegerArray): Integer; </source> ==Availability== SCAR Divi 3.21 > Current ...")
 
 
Line 1: Line 1:
 
==Definition==
 
==Definition==
 
<source lang="scar" lines="false">
 
<source lang="scar" lines="false">
function GetClosestColor(Color: Integer; Colors: TIntegerArray): Integer;
+
function GetClosestColor(Color: Integer; Colors: TIntArray): Integer;
 
</source>
 
</source>
  
 
==Availability==
 
==Availability==
 
SCAR Divi 3.21 > Current
 
SCAR Divi 3.21 > Current
 +
 +
* '''Values''' was a [[TIntegerArray]] before SCAR Divi 3.28.
  
 
==Description==
 
==Description==
Calculates which color in a given [[TIntegerArray]] '''Colors''' is the most similar to the color given by '''Color''' using the current tolerance algorithm and returns it. The tolerance algorithm can be changed using [[ColorToleranceSpeed]].
+
Calculates which color in a given [[TIntArray]] '''Colors''' is the most similar to the color given by '''Color''' using the current tolerance algorithm and returns it. The tolerance algorithm can be changed using [[ColorToleranceSpeed]].
  
 
==Example==
 
==Example==

Latest revision as of 11:21, 21 October 2011

Definition

function GetClosestColor(Color: Integer; Colors: TIntArray): Integer;

Availability

SCAR Divi 3.21 > Current

Description

Calculates which color in a given TIntArray Colors is the most similar to the color given by Color using the current tolerance algorithm and returns it. The tolerance algorithm can be changed using ColorToleranceSpeed.

Example

begin
  WriteLn(GetClosestColor(100, [97, 98, 101]));
end.

Output:

101

See Also