Void floodfill(int x,int y,char BorderColor,char NewColor)
Download 33.39 Kb.
|
aziz
Muhammad Al-Xorazmiy nomidagi Toshkent Axborot texnologiyalari Universiteti 512-21 guruh talabasi Qo`chqorov Azizbekning Kompyuter grafikasi fanidan 2-mustaqil ishi. #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 (950,800); float X,Y; s=7; beze(506,179,528,205,534,231,535,251,X,Y); beze(535,251,530,266,516,280,504,289,X,Y); beze(504,289,485,298,485,298,462,305,X,Y); beze(462,305,487,323,515,334,547,344,X,Y); beze(547,344,586,359,605,372,616,392,X,Y); beze(616,392,617,401,617,405,618,405,X,Y); beze(618,405,622,406,625,408,626,411,X,Y); beze(626,411,623,415,620,414,616,412,X,Y); beze(616,412,615,416,614,418,612,422,X,Y); beze(612,422,616,425,619,428,618,432,X,Y); beze(618,432,615,434,612,433,608,429,X,Y); beze(608,429,605,432,602,436,599,439,X,Y); beze(599,439,602,443,603,447,602,449,X,Y); beze(602,449,599,450,597,448,596,447,X,Y); beze(596,447,593,444,588,447,573,450,X,Y); beze(573,450,558,446,546,441,536,436,X,Y); beze(536,436,529,431,520,422,513,415,X,Y); beze(513,415,505,406,496,399,486,393,X,Y); beze(486,393,469,382,462,376,454,366,X,Y); beze(454,366,452,362,449,357,448,351,X,Y); beze(448,351,448,345,448,345,448,345,X,Y); beze(448,345,448,345,448,345,463,303,X,Y); beze(463,303,460,305,455,308,427,312,X,Y); beze(469,382,475,399,487,433,495,454,X,Y); beze(495,454,499,476,497,487,493,495,X,Y); beze(493,495,489,501,485,506,480,510,X,Y); beze(480,510,448,522,448,522,443,522,X,Y); beze(480,497,480,510,481,518,483,532,X,Y); beze(483,532,486,543,492,556,504,579,X,Y); beze(504,579,508,591,510,600,509,607,X,Y); beze(509,607,505,616,489,639,471,656,X,Y); beze(471,656,449,668,439,671,424,673,X,Y); beze(424,673,423,680,421,683,417,682,X,Y); beze(417,682,416,677,417,672,420,664,X,Y); beze(420,664,423,664,423,669,424,673,X,Y); beze(424,673,413,673,400,671,392,668,X,Y); beze(392,668,386,665,380,660,375,654,X,Y); beze(375,654,371,648,371,641,375,626,X,Y); beze(375,626,390,604,407,588,411,586,X,Y); beze(411,586,422,581,432,579,446,581,X,Y); beze(400,671,398,676,396,680,393,680,X,Y); beze(393,680,391,676,392,668,396,661,X,Y); beze(396,661,399,659,401,660,400,671,X,Y); beze(380,660,375,666,373,663,373,659,X,Y); beze(373,659,375,654,380,650,383,650,X,Y); beze(383,650,382,654,380,660,380,660,X,Y); beze(411,586,406,569,404,555,404,538,X,Y); beze(443,522,417,534,404,538,382,543,X,Y); beze(382,543,327,539,295,526,282,518,X,Y); beze(295,526,289,546,280,570,273,588,X,Y); beze(273,588,268,607,262,617,255,624,X,Y); beze(255,624,243,627,219,626,179,609,X,Y); beze(179,609,150,587,135,560,136,544,X,Y); beze(136,544,140,538,144,533,147,529,X,Y); beze(147,529,153,524,161,521,185,517,X,Y); beze(136,544,133,540,135,537,140,538,X,Y); beze(144,533,137,526,142,525,147,529,X,Y); beze(153,524,149,520,145,516,148,513,X,Y); beze(148,513,152,514,154,516,161,521,X,Y); beze(161,521,163,525,160,528,153,524,X,Y); beze(161,521,185,517,197,518,207,521,X,Y); beze(207,521,218,528,230,539,239,552,X,Y); beze(207,521,216,513,231,496,237,487,X,Y); beze(237,487,239,483,242,478,242,478,X,Y); beze(237,487,245,490,267,505,284,520,X,Y); beze(237,487,227,455,227,408,238,373,X,Y); beze(262,339,270,330,280,315,289,308,X,Y); beze(238,373,250,352,252,349,262,339,X,Y); beze(250,352,233,367,196,382,145,387,X,Y); beze(145,387,126,380,107,365,103,358,X,Y); beze(103,358,97,342,96,334,97,318,X,Y); beze(97,318,98,309,104,300,116,287,X,Y); beze(116,287,133,280,152,279,181,286,X,Y); beze(181,286,200,294,222,303,243,309,X,Y); beze(243,309,264,310,276,309,289,308,X,Y); beze(427,312,407,316,362,320,317,317,X,Y); beze(317,317,295,311,289,308,261,294,X,Y); beze(261,294,245,282,229,265,220,249,X,Y); beze(220,249,220,243,225,224,232,207,X,Y); beze(232,207,240,184,243,169,245,149,X,Y); beze(107,365,97,365,95,362,99,360,X,Y); beze(99,360,103,358,103,358,103,358,X,Y); beze(97,342,86,340,86,336,96,334,X,Y); beze(97,318,89,316,88,311,98,309,X,Y); beze(245,149,226,149,209,140,202,130,X,Y); beze(202,130,201,105,216,76,236,62,X,Y); beze(236,62,257,60,272,66,281,76,X,Y); beze(245,149,248,132,255,109,265,91,X,Y); beze(265,91,281,76,308,63,352,53,X,Y); beze(352,53,391,53,421,61,421,61,X,Y); beze(421,61,445,44,474,38,506,44,X,Y); beze(506,44,545,77,558,110,550,147,X,Y); beze(550,147,533,170,521,179,506,179,X,Y); beze(506,179,490,90,440,69,421,61,X,Y); beze(281,137,270,149,265,150,263,147,X,Y); beze(263,147,267,140,273,133,281,137,X,Y); beze(394,145,401,158,406,159,408,153,X,Y); beze(408,153,399,138,395,138,394,145,X,Y); beze(356,292,381,294,399,289,412,275,X,Y); beze(412,275,414,259,401,237,379,222,X,Y); beze(379,222,348,210,325,205,303,204,X,Y); beze(303,204,274,208,257,219,251,229,X,Y); beze(251,229,251,246,272,274,284,280,X,Y); beze(284,280,309,280,374,287,371,288,X,Y); //beze(373,252,379,254,383,259,383,259,X,Y); //beze(371,265,379,254,379,254,379,254,X,Y); beze(379,222,390,204,395,185,395,179,X,Y); beze(395,179,394,174,391,175,377,165,X,Y); beze(377,165,361,172,350,189,348,213,X,Y); beze(303,204,305,179,301,167,292,160,X,Y); beze(292,160,277,163,268,171,267,176,X,Y); beze(267,176,267,192,274,208,274,211,X,Y); beze(284,280,295,294,329,303,348,295,X,Y); beze(348,295,356,292,366,284,366,284,X,Y); beze(270,224,293,215,312,214,335,220,X,Y); beze(335,220,342,230,337,244,305,253,X,Y); beze(305,253,298,254,267,242,270,224,X,Y); //beze(267,242,295,262,299,267,301,270,X,Y); floodfill(300,300,s,WHITE); floodfill(300,500,s,WHITE);/* floodfill(187,277,s,WHITE); floodfill(227,277,s,WHITE); floodfill(144,346,s,BLUE); floodfill(270,340,s,BLUE); floodfill(200,400,s,WHITE); floodfill(160,490,s,BLUE); floodfill(250,490,s,BLUE); floodfill(200,230,s,YELLOW); floodfill(117,324,s,YELLOW); floodfill(187,160,s,WHITE);*/ getch(); closegraph(); return 0; } Download 33.39 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling