Delphining grafik imkoniyatlari


-listing. Uchayotgan samolyot


Download 0.58 Mb.
bet22/29
Sana09.03.2023
Hajmi0.58 Mb.
#1254496
1   ...   18   19   20   21   22   23   24   25   ...   29
Bog'liq
delphi uzb графика

10.10-listing. Uchayotgan samolyot
unit anim_;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, ExtCtrls, StdCtrls, Buttons;
type
TForm1 = class(TForm)
Timer1: TTimer;
Image1: Tlmage;
procedure FormActivate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
var
Back, bitmap, Buf : TBitMap; // fon, rasm, bufer
BackRct : TRect; // fonning buferdan tiklanishi kerka bo’lgan qismi
BufRet: Trect; // buferning fonni tiklash uchun foydalaniluvchi qismi
х,у:integer; // rasmni joylashishi
W,H: integer; // rasmning o’lchamlari
procedure TForm1.FormActivate(Sender: TObject);
begin
// bitli tasvir bo’lgan uchta ob’yekt yaratish
Back := TBitmap.Create; // fon
bitmap := TBitmap.Create; // rasm
Buf := TBitmap.Create; // bufer
// fonni yuklash va chiqarish
Back.LoadFromFile('factory.bmp');
Form1.Image1.canvas.Draw(0,0,Back);
// xarakatlanuvchi rasmni yuklash
bitmap.LoadFromFile('aplane.bmp');
// “ko’rinmas” rangni aniqlaymiz
bitmap.Transparent := True;
bitmap.TransParentColor := bitmap.canvas.pixels[1,1];
// fonning tikanishi kerak bo’lgan qismini saqlash uchun bufer tashkil qiilsh
W:= bitmap.Width;
Н:= bitmap.Height;
Buf.Width:= W;
Buf.Height:=H;
Buf.Palette:=Back.Palette;
Buf.Canvas.CopyMode:=cmSrcCopy;
// fonni tiklash uchun foydalaniluvchi bufer sohasini aniqlaymiz
BufRct:=Bounds(0,0,W,H);
// rasmni boshlang’ich joylashishi
х := -W; у := 20;
// fonning saqlaniluvchi sohasini aniqlaymiz
BackRct:=Bounds(x,y,W,H); // va uni saqlaymiz
Buf.Canvas.CopyRect(BufRet,Back.Canvas,BackRct);

Download 0.58 Mb.

Do'stlaringiz bilan baham:
1   ...   18   19   20   21   22   23   24   25   ...   29




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling