Difference between revisions of "GetColor"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <func>function GetColor(x, y: Integer): Integer;</func> ==Availability== SCAR Divi 3.00 > Current ==Description== This function returns the color at a given set ...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Definition==
 
==Definition==
<func>function GetColor(x, y: Integer): Integer;</func>
+
<source lang="scar" lines="false">
 +
function GetColor(const X, Y: Integer): Integer;
 +
</source>
  
 
==Availability==
 
==Availability==
Line 6: Line 8:
  
 
==Description==
 
==Description==
This function returns the color at a given set of coordinates ('''x''', '''y''') relative to the client window. The function returns -1 if the coordinates are outside of the client's boundaries.
+
This function returns the color at a given set of coordinates ('''X''', '''Y''') relative to the client window. The function returns -1 if the coordinates are outside of the client's boundaries.
  
 
==Example==
 
==Example==
Line 14: Line 16:
 
   x, y: Integer;
 
   x, y: Integer;
 
   col: Integer;
 
   col: Integer;
 +
 
begin
 
begin
 
   GetClientDimensions(w, h);
 
   GetClientDimensions(w, h);
Line 24: Line 27:
  
 
==See Also==
 
==See Also==
 +
*[[GetColors]]
 
*[[FindColor]]
 
*[[FindColor]]
  
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:Color Functions]]
 
[[Category:Color Functions]]

Latest revision as of 16:38, 23 November 2012

Definition

function GetColor(const X, Y: Integer): Integer;

Availability

SCAR Divi 3.00 > Current

Description

This function returns the color at a given set of coordinates (X, Y) relative to the client window. The function returns -1 if the coordinates are outside of the client's boundaries.

Example

var
  w, h: Integer;
  x, y: Integer;
  col: Integer;

begin
  GetClientDimensions(w, h);
  x := Random(w);
  y := Random(h);
  col := GetColor(x, y);
  WriteLn('Color at (' + IntToStr(x) + ', ' + IntToStr(y) + ') is ' + IntToStr(col));
end.

See Also