Search code examples
delphiidentifierscanline

delphi Undeclared identifier: 'scanline'


i have the following error message in Delphi 7:

Undeclared identifier: 'scanline'

my uses: uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, Buttons, StdCtrls, ExtCtrls,math, ComCtrls;

my part of code:

screenshot(0,0,screen.Width,screen.Height,bmp);
for a:=1 to screen.Height do begin
pxl:=scanline[a-1];
end;

where pxl is PByteArray;

screenshot is a procedure that catching the selected area into a bitmap...

AFAIK scanline function using Graphics library, but it does not works..

What I am doing wrong?

Thanks


Solution

  • [ScanLine][1] is not a standalone function. It's a method of some graphics classes such as TBitmap. You need an instance of one of those classes in order to call ScanLine. ScanLine also does not return a single pixel, but an entire line of pixels at once.

    Presuming that the bmp in your call to screenshot is a TBitmap, you can use bmp.ScanLine[a - 1];, which would return a pointer to an entire line (row) of pixels.