"Komputer injiniringi" fakulteti


Download 35.03 Kb.
Sana31.01.2024
Hajmi35.03 Kb.
#1817982
Bog'liq
KG maruza 3




Muhammad al-Xorazmiy nomidagi Toshkent axborot texnologiyalari universiteti


“Komputer injiniringi” fakulteti
“Multimediya texnologiyalari” kafedrasi
“ Komputer grafikasi” fanidan


3-mustaqil ish

Guruh: CPR001-1


Bajardi: To’g’onboyev F.
Tekshirdi: Qayumova G.

Toshkent 2023.



3-mustaqil ish.


Beze funksiyuasi orqali o’z rasmimizni chizish.

Kod qismi:


#include


#include
#include
#include
#include
float t;
int i,s;
void floodfill(int x,int y,char BorderColor,char NewColor)
{
if(getpixel(x,y)!=BorderColor)
{
if(getpixel(x,y)!=NewColor)
{
putpixel(x,y,NewColor);
floodfill(x-1,y,BorderColor,NewColor);
floodfill(x+1,y,BorderColor,NewColor);
floodfill(x,y-1,BorderColor,NewColor);
floodfill(x,y+1,BorderColor,NewColor);
}}}
int beze(int x1,int y1,int x2, int y2,int x3,int y3,int x4,int y4,float &X,float &Y)
{
for(i=0;i<1000;i++)
{
t=i/1000.;
X=pow((1-t),3)*x1+3*t*(1-t)*(1-t)*x2+3*t*t*(1-t)*x3+t*t*t*x4;
Y=pow((1-t),3)*y1+3*t*(1-t)*(1-t)*y2+3*t*t*(1-t)*y3+t*t*t*y4;
putpixel(X,Y,s);
}}

int main()


{
initwindow (1300,690);

float X,Y;


s=0;
floodfill(5,5,WHITE);
//Bashara
beze(247,343,259,354,282,356,349,329,X,Y);
beze(349,329,369,317,380,294,380,254,X,Y);
beze(380,254,396,254,408,243,412,218,X,Y);
beze(412,218,414,187,396,177,384,187,X,Y);
beze(388,182,391,134,374,89,350,75,X,Y);
beze(350,75,321,51,255,52,217,75,X,Y);
beze(217,75,188,94,170,140,174,175,X,Y);
beze(174,175,174,182,177,188,179,192,X,Y);
beze(179,192,186,204,192,227,194,251,X,Y);
beze(194,251,195,267,204,287,216,310,X,Y);
beze(216,310,226,325,238,336,247,343,X,Y);
//Chach
beze(388,182,381,187,376,197,374,211,X,Y);
beze(374,211,368,173,358,160,350,159,X,Y);
beze(350,159,345,159,341,156,342,145,X,Y);
beze(342,145,338,130,327,124,317,127,X,Y);
beze(317,127,310,130,290,132,275,135,X,Y);
beze(275,135,253,135,215,158,209,171,X,Y);
beze(209,171,203,168,201,158,203,153,X,Y);
beze(203,153,199,157,193,171,194,177,X,Y);
beze(194,177,189,178,183,175,182,169,X,Y);
beze(182,169,181,172,179,186,182,196,X,Y);
//O'ng qosh
beze(224,205,208,205,200,211,194,219,X,Y);
beze(194,219,205,214,221,210,234,213,X,Y);
beze(234,213,232,208,228,205,224,205,X,Y);
//Chap qosh
beze(273,201,267,203,263,196,270,193,X,Y);
beze(270,193,290,183,308,183,323,192,X,Y);
beze(323,192,309,192,283,196,273,201,X,Y);
//O'ng ko'z
beze(237,227,227,215,207,223,201,229,X,Y);
beze(237,225,227,229,210,231,201,229,X,Y);
beze(214,221,213,228,227,229,228,220,X,Y);
//Chap ko'z
beze(279,217,285,206,309,203,320,210,X,Y);
beze(279,217,289,217,312,213,320,210,X,Y);
beze(297,206,293,207,296,214,299,214,X,Y);
//Burun
beze(247,225,248,237,244,255,241,264,X,Y);
beze(241,264,237,272,243,281,256,278,X,Y);
beze(256,278,260,278,270,272,275,272,X,Y);
beze(275,272,281,274,287,267,284,263,X,Y);
//Qulaq
beze(383,201,388,183,410,185,406,213,X,Y);
beze(386,202,399,210,402,221,398,227,X,Y);
beze(382,212,391,220,385,234,386,235,X,Y);
//Lo'v
beze(240,309,251,297,258,294,264,298,X,Y);
beze(264,298,266,300,269,299,270,297,X,Y);
beze(270,297,274,293,288,293,302,301,X,Y);
beze(302,301,285,318,260,320,240,309,X,Y);
beze(302,301,288,305,254,309,240,309,X,Y);
//Yelkalar va tana
beze(265,350,253,357,237,368,232,373,X,Y);
beze(241,366,218,370,204,382,194,434,X,Y);
beze(194,434,193,439,186,449,183,451,X,Y);
beze(183,451,178,456,176,472,175,486,X,Y);
beze(174,474,155,483,116,530,113,553,X,Y);
beze(113,553,103,555,87,571,84,584,X,Y);
beze(85,577,81,579,70,595,69,600,X,Y);
beze(182,465,181,479,198,504,217,515,X,Y);
beze(173,483,179,500,201,515,215,518,X,Y);
beze(209,398,208,441,233,534,258,569,X,Y);
beze(255,563,247,577,233,595,226,600,X,Y);
beze(255,563,255,563,269,600,269,600,X,Y);
beze(281,350,283,357,321,403,320,412,X,Y);
beze(385,254,383,254,388,300,388,300,X,Y);
beze(387,278,394,286,395,297,359,428,X,Y);
beze(359,428,355,445,340,457,325,462,X,Y);
beze(325,462,325,462,323,464,321,466,X,Y);
beze(387,278,435,317,437,320,425,441,X,Y);
beze(425,441,425,448,413,451,357,439,X,Y);
beze(282,357,264,425,267,440,282,449,X,Y);
beze(282,449,291,453,298,471,323,485,X,Y);
beze(301,381,298,391,301,409,308,420,X,Y);
beze(308,420,314,431,323,460,323,490,X,Y);
beze(299,392,296,401,288,435,291,457,X,Y);
beze(420,306,437,304,458,312,468,327,X,Y);
beze(458,316,477,317,533,341,558,369,X,Y);
beze(454,322,455,342,442,394,434,417,X,Y);
beze(558,398,513,393,446,454,446,496,X,Y);
beze(458,412,435,438,431,503,456,566,X,Y);
beze(479,519,468,525,461,540,463,550,X,Y);
beze(558,473,489,514,465,542,466,550,X,Y);
beze(462,564,453,577,452,592,454,600,X,Y);
beze(323,490,323,490,323,600,323,600,X,Y);
beze(351,451,348,464,344,483,342,600,X,Y);
beze(69,20,69,20,558,20,558,20,X,Y);
beze(558,20,558,20,558,600,558,600,X,Y);
beze(558,600,558,600,69,600,69,600,X,Y);
beze(69,600,69,600,69,20,69,20,X,Y);
//rang berish
floodfill(325,250,s,YELLOW);
floodfill(331,372,s,YELLOW);
floodfill(275,312,s,LIGHTRED);
floodfill(258,302,s,LIGHTRED);
floodfill(287,191,s,BLACK);
floodfill(211,208,s,BLACK);
floodfill(220,224,s,BLACK);
floodfill(303,209,s,BLACK);
floodfill(211,117,s,BLACK);
getch();
closegraph();
return 0;
}

Natija:



Download 35.03 Kb.

Do'stlaringiz bilan baham:




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