Delphining grafik imkoniyatlari


Download 0.58 Mb.
bet28/29
Sana09.03.2023
Hajmi0.58 Mb.
#1254496
1   ...   21   22   23   24   25   26   27   28   29
Bog'liq
delphi uzb графика

10.19-rasm. Multikning kadrlari


10.20-rasm. Dastur formasi
10.12-listing. Multik (CopyRect uslubidan foydalanish)
unit multik ;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure FormActivate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1l: TForm1;
implementation
($R *.DFM}
const
FILMFILE = 'film2.bmp'; // film — bmp-fayl
N_KADR=12; // filmdagi kadrlar (joriy fayl uchun)
var
Film: TBitMap; // film — barcha kadrlar
WKadr,HKadr: integer; // kadrning kengligi va balandligi
CKadr: integer; // joriy kadrning tartib raqami
RectKadr: TRect; // положение и размер кадра в фильме
Rect1 : Trect; // film chiquvchi soha koordinatasi va o’lchami
procedure TForm1.FormActivate(Sender: TObject);
begin
Film := TBitMap.Create;
Film.LoadFromFile(FILMFILE);
WKadr := Round(Film.Width/N_Kadr);
HKadr := Film.Height;
Rect1 := Bounds(10,10,WKadr,HKadr);
Ckadr:=0;
Form1.Timerl.Interval := 150; // kadrni almashtirish oraliq vaqti — 0.15 с
Form1.Timerl.Enabled:=True; // taymer ishga tishirish
end;
// kadrni chizish
procedure DrawKadr;
begin
// joriy kadrning filmdagi o’rnini aniqlaymiz
RectKadr:=Bounds(WKadr*CKadr,0,WKadr,HKadr);
// filmdan kadrni chiqarish
Form1.Canvas.CopyRect(Rect1,Film*.Canvas,RectKadr);
//navbatdagi kadrni chiqarishga tayyorlaymiz
CKadr := CKadr+1;
if CKadr = N_KADR then CKadr:=0;:

Download 0.58 Mb.

Do'stlaringiz bilan baham:
1   ...   21   22   23   24   25   26   27   28   29




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