Image1.Canvas.Arc(0,0,100,100, 50,0,0,50);
Image1.Canvas.Arc(100,0,200,100, 0,50,150,0);
Ellips segmentini rasmga qo‘shish uchun Cord(x1,y1,x2,y2, x3,y3,x4,y4) usulidan foydalaniladi. Unga misol quyida keltirilgan:
Image1.Canvas.Chord(0,0,100,100, 50,0,0,50);
Image1.Canvas.Chord(100,0,200,100, 0,50,150,0);
3. Ranglar palitrasi. Piksellar xossasi yordamida qizil va yashil
ranglarni turli ulushda aralashtirishdan hosil bo‘ladigan 65536 ta rangli
piksellarni ekranda tasvirlaydigan ilova yaratamiz. Ilovaga Image
(256×256) va Button obyektlarini quyidagi rasmda ko‘rsatilgandek
joylaymiz. Button tugmasini ikki marta bosib, dastur kodiga quyidagi
protsedurani kiritamiz:
procedure TForm1.Button1Click(Sender: TObject);
var i,j,rang:integer;
begin for i:=0 to 255 do
for j:=0 to 255 do begin rang:=RGB(i,j,0);
Image1.Canvas.Pixels[i,j]:=rang; end; end;
Ilovani ishga tushirib, qizil va yashil ranglarning aralashib, sariq rang
hosil bo‘lishini ko‘ramiz:
Amaliyn topshiriq Koptok ilovasi.
Timer obyektidan birinchi navbatda animatsion harakat yaratish uchun foydalaniladi. Bu qanday amalga oshirilishini ko‘rish uchun yangi ilova yaratamiz. Unga yetarlicha katta Image obyektini, bittadan Timer, CheckBox va SpinEdit larni joylaymiz.
Timer obyektini ikki marta bosib uning protsedurasini quyidagicha
to‘ldiramiz:
procedure TForm1.Timer1Timer(Sender: TObject);
var n:integer;
begin
n:=SpinEdit1.Value;
if not CheckBox1.Checked then
Image1.Canvas.Rectangle(-3,-3,Image1.Width+3,Image1.Height+3); x:=x+dx*n;
if x>Image1.Width then
begin x:=2*Image1.Width-x; dx:=-dx;end;
if x<0 then begin x:=-x; dx:=-dx;end;
y:=y+dy*n;
0>
Do'stlaringiz bilan baham: |