Ellipse
. Bu ellipsni chizadi, to`g`ri burchakli to`rt burchak kabi.
RoundRect
. Aniq chegaralangan to`g`ri burchakli to`rt burchak chizadi.
Pixels
. Ikki o`lchovli massiv bo`lib piksellar ranggini saqlaydi. Birinchi
o`lchov - X, ikkinchisi - Y.
Draw
. Berilgan nuqtada (X,Y) TGraphic ob`yektini chiqarish. TGraphic –
abstract (barcha virtual metodlar bilan) sinf. Uni dasturda to`g`ridan to`g`ri
foydalanib bo`lmaydi. U meroslari - TBitmap, TIcon, TMetaFile. Bularning
barchasiga rasmlar, ikonkalar, metafayllar kiradi va - .bmp, .ico, .wmf, .emf.
TJPEGImage nomi sinf ham mavjudki, JPEG formatli rasmlarni ko`rsatadi.
StretchDraw
. Bu ham xuddi Draw kabi, faqat bu rasmlarni TRect
yordamida avtomatik masshtabga keltiradi. Masalan,
314
Canvas->StretchDraw(TRect(0,0,40,40),MyGraphic);
CopyRect
. Bir sohani nusxalash.
CopyMode
. Nusxalash usuli. Xuddi Mode xossasiga o`xshash.
Yuqoridagi funksiya va usullardan foydalanib biz C++ Builderda ixtiyoriy
grafikni hosil qilishimiz mumkin. Masalan,
ning garafigini chizish.
6.6-listing.
ning garafigini chizish.
Canvas->MoveTo(15,15);
Canvas->Pen->Color=RGB(255,255,0);
for(int i=0;i<30;i++) {
Canvas->LineTo(i*10,(i*i)*10);}
Rangli quyosh
Canvas->MoveTo(ClientWidth/2,ClientHeight/2);
Canvas->Pen->Color=RGB(random(255),random(255),random(255));
Canvas->LineTo(random(ClientWidth),random(ClientHeight));
To`g`ri burchakli to`rtburchak.
Canvas->Rectangle(50,50,150,150);
Fon o`rnatish
Canvas->Brush->Style=bsCross;
TRect tRect(0,0,100,100);
Canvas->FillRect(tRect);
Fonli ellips
Canvas->Brush->Style=bsDiagCross;
Canvas->Pen->Color = clBlue;
Canvas->Pen->Mode=pmNotCopy;
Canvas->Ellipse(0,0,500,500);
Matn chiqarish
AnsiString vasS="Matn";
315
Canvas->Font->Color=clRed;
Canvas->Font->Size=50;
Canvas->TextOutA(50,50,vasS);
Besh yulduz
TPoint tPoints[6];
Canvas->Pen->Color = clRed;
Canvas->Pen->Width=3;
tPoints[0].x = 40;
tPoints[0].y = 10;
tPoints[1].x = 20;
tPoints[1].y = 60;
tPoints[2].x = 70;
tPoints[2].y = 30;
tPoints[3].x = 10;
tPoints[3].y = 30;
tPoints[4].x = 60;
tPoints[4].y = 60;
tPoints[5].x = 40;
tPoints[5].y = 10;
Canvas->Polyline(tPoints,5);
|