Difference between revisions of "GetColor"

From SCAR Divi Manual
Jump to: navigation, search
Line 16: Line 16:
 
   x, y: Integer;
 
   x, y: Integer;
 
   col: Integer;
 
   col: Integer;
 +
 
begin
 
begin
 
   GetClientDimensions(w, h);
 
   GetClientDimensions(w, h);

Revision as of 21:19, 27 June 2011

Definition

function GetColor(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