Показать сообщение отдельно
  #4  
Старый 11.01.2008, 11:51
Аватар для The Shadow
The Shadow The Shadow вне форума
Продвинутый
 
Регистрация: 11.06.2007
Адрес: Уфа, Россия
Сообщения: 793
Репутация: 35
По умолчанию

Забыл. Надо еще и класс 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. Если вы программист - делать вид, что так было задумано.
Ответить с цитированием