Забыл. Надо еще и класс TScanlines создать.
Код:
type
TScanlines = class
private
FScanLine0 : PByte;
FScanLineIncrement : integer;
FMaxRow : integer;
function GetRowPtr(Index: integer): PByte;
public
constructor Create(Bitmap: TBitmap);
destructor Destroy; override;
property RowPtr[Index: Integer]: PByte read GetRowPtr; default;
end;
...
implementation
...
constructor TScanlines.Create(Bitmap: TBitmap);
begin
inherited Create;
FScanLine0 := nil;
FScanLineIncrement := 0;
FMaxRow := 0;
if Bitmap <> nil then begin
FScanLine0 := Bitmap.ScanLine[0];
FScanLineIncrement := integer(Bitmap.Scanline[1]) -integer(FScanLine0);
FMaxRow := Bitmap.Height;
end;
end;
destructor TScanlines.Destroy;
begin
inherited;
end;
function TScanlines.GetRowPtr(Index: integer): PByte;
begin
if (Index >= 0) and (Index < FMaxRow) then begin
result := FScanLine0;
Inc(result, FScanLineIncrement *Index);
end else
result := nil;
end;
А вызвать можно например нро нажатии на кнопку.
Код:
procedure TForm1.Button1Click(Sender: TObject);
begin
AntiAliasRect(Image1.Picture.Bitmap, 0, 0, Image1.Width, Image1.Height); //Чтобы все работало, надо на форму добавить кнопку (TButton) и изображение (TImage)
end;
И в uses добавить Math
__________________
Что делать, когда сломался комп:
1. Если вы юзер - делать ноги.
2. Если ремонтник - делать деньги.
3. Если вы программист - делать вид, что так было задумано.
|