12-mavzu. Grafik va multimediya dasturlash tizimlarida qo’llash reja


Download 44.19 Kb.
bet4/6
Sana23.04.2023
Hajmi44.19 Kb.
#1383398
1   2   3   4   5   6
Bog'liq
12-MAVZU. GRAFIK VA MULTIMEDIYA DASTURLASH TIZIMLARIDA QO’LLASH.

setcolor (11);
// to’q feruza rangli qalam
bar3d(200, 300, 100, 150, 30, topon);
// parallelopiped, ichi oq
setcolor (CYAN);
// och feruza rangli qalam
fillellipse (350, 360, 135, 90);
//ellips, ichiokrangda
getch( );
closegraph( );
}

2-misol.
…….
void main ( )
{
gd=0;
initgraph (&gd, &gm, ' ');
setbkcolor (BLUE);
setcolor (14);
rectangle (120, 130, 240, 250);
setcolor (6);
line (120, 130, 180, 80);
s etcolor (2);
line (180, 80, 240, 130);
s etcolor (14);
rectangle (160, 160, 200, 250);
setcolor (4);
setfillstyle(7, 9);
circle( 300, 300, 50);
floodfill (300, 300, 4);
getch( );
closegraph ( );
}
Grafik rejimida shriftlar
Grafik rejimi xolatida turli shriftlardan foydalanib matnlarni xam yozsa bo’ladi. Shriftlar .chr kengaytmali fayllarda saqlanadi. Ular .bgi fayllari bilan bitta katalogda saqlanishi shart.
1. outtextxy (x, y, 'matn'); - matnni yozish; bu yerda x va y matn boshlanadigan nuqta koordinatalari; masalan: outtextxy (10, 10, 'Mirzaev K. 212-07 Aty‟);
2. settextstyle (sh, n, r); mant shriftini o’rnatish; bu yerda sh – shrift nomeri (0 – vektorli shrift, 1 – standart shrift); n – shrift yo’nalishi (0 – chapdan o’ngga, 1 – quyidan yuqoriga yozish); r – shrift razmeri (oddiy shriftda 1, vektorli shriftda 4 deb olinadi);
3. settextjustify (h, v) – yozilgan qatorni tekislaydi. U outtextxy protsedurasidan keyin yoziladi. Bu yerda h – gorizontal tekislash; v – vertical tekislash; Gorizontal tekislash uchun: 0 - chapga; 1- markazga; 2 – o’ngga. Vertikal tekislash uchun: 0 - pastga; 1 - markazga; 2 - yukoriga.
4. setusercharsize – vector shriftlari uchun bir xil simvollarning eni va bo’yini o’rnatadi. Masalan: setUserCharSize(x1, y1, x2, y2);
3-misol. Funktsiyalarning grafiklarini chizish.
# include
# include
# include
void main ( )
{
int i, j, gd, gm;
float x, y;
gd=0; initgraph (&gd, &gm, " ");
setcolor (14);
line (320, 0, 320, 480);
line (0, 240, 640, 240);
line (480, 0, 480, 235);
line (325, 120, 635, 120);
line (160, 245, 160, 475);
line (0, 360, 315, 360);
line (480, 245, 480, 475);
line (325, 360, 635, 360);
x =-10;
outtextxy(10, 20, ' y=sin(x) grafigi');
do { y = sin(x);
putpixel (160 + 10*x, 120 - y, 5);
x = x+0.001; } while (x<=10);
x1 = -10;
outtextxy(10, 20, ' y=cos(x) grafigi');
do { y = cos(x1);
putpixel (480 + 20*x1, 120 - 20*y1, 6);
x1 = x1+0.001;
}
while (x1 < =10);
x2 = -10; outtextxy(10, 20, ' y=exp(x) grafigi');
do { y2 = exp(x2);
putpixel (160 + 10*x2, 360 - 20*y2, 7);
x2 = x2+0.001;
}
while (x2 <=10);
x3 = -10;
outtextxy(10, 20, ' y=ln(x) grafigi');
do { y3 = ln(x3);
putpixel (480 + 10*x3, 360 - y3, 8);
x3 = x3+0.001;
}
while (x3 <=10);
getch( );
closegraph( );
}

Download 44.19 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




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