GetRectImage

Returns image of the specified area of the browser window.

Syntax

function GetRectImage(aLeft: integer; aTop: integer; aRight: integer;
  aBottom: integer): TCSImage; overload;
 
function GetRectImage(aRect: TCSRect): TCSImage; overload;

Parameters

  • aLeft
    • type: integer
    • functions: X coordinate of the upper-left corner of the rectangular area relative to browser window
  • aTop
    • type: integer
    • functions: Y coordinate of the upper-left corner of the rectangular area relative to browser window
  • aRight
    • type: integer
    • functions: X coordinate of the lower-right corner of the rectangular area relative to browser window
  • aBottom
    • type: integer
    • functions: Y coordinate of the lower-right corner of the rectangular area relative to browser window
  • aRect
    • type: TCSRect
    • functions: rectangle, area of which has to be obtained in the image

Returned value

  • type: TCSImage
  • functions: image of the specified area

Examples

  1. //Load a page with image (in this case - captcha)
    LoadURI('http://www.google.com/recaptcha/learnmore');
    //Get an element, containing the image
    var ImageElement:=GetElement('img',0,['src'],['google.com/recaptcha/']);
    //Get an element rectangle
    var ImageRect:=GetElementRect(ImageElement);
    //Get the image of the rectangle area
    var Image:=GetRectImage(ImageRect);
    //Deduce to the log  the color of image pixel  with coordinates (10,10)
    Log(IntToStr(Image.Pixels[10,10]));