資源簡介
使用C語言不光只能編寫一些無聊的管理系統(tǒng),還可以用來畫畫,那么我們就來利用C語言進行圖形的繪制

代碼片段和文件信息
#include?“stdio.h“
#include?“graphics.h“
#define?K?20//單元格與像素比例
main()
{
initgraph(600600);
setbkcolor(WHITE);
//A區(qū)繪制
// setcolor(YELLOW);
setcolor(0x1DB5FB);
int?A1X=12*KA1Y=5*K;
int?A2X=11*KA2Y=7*K;
int?A3X=9*KA3Y=7.5*K;
int?A4X=11*KA4Y=8*K;
int?A5X=12*KA5Y=12*K;
int?A6X=13*KA6Y=8*K;
int?A7X=14*KA7Y=7.5*K;
int?A8X=13*KA8Y=7*K;
line(A1XA1YA2XA2Y);
line(A2XA2YA3XA3Y);
line(A3XA3YA4XA4Y);
line(A4XA4YA5XA5Y);
line(A5XA5YA6XA6Y);
line(A6XA6YA7XA7Y);
line(A7XA7YA8XA8Y);
line(A8XA8YA1XA1Y);
// setfillstyle(YELLOW);
// floodfill(12*K7.5*KYELLOW);
setfillstyle(0x1DB5FB);
floodfill(12*K7.5*K0x1DB5FB);
//B區(qū)繪制
setcolor(0xCC7B49);
int?B1X=9*KB1Y=13*K;
int?B2X=9*KB2Y=18.5*K;
int?B3X=10*KB3Y=19*K;
int?B4X=12*KB4Y=20*K;
int?B5X=13*KB5Y=21*K;
int?B6X=14*KB6Y=26*K;
int?B7X=14*KB7Y=15*K;
int?B8X=12*KB8Y=14*K;
line(B1XB1YB2XB2Y);
line(B2XB2YB3XB3Y);
line(B3XB3YB4XB4Y);
line(B4XB4YB5XB5Y);
line(B5XB5YB6XB6Y);
line(B6XB6YB7XB7Y);
line(B7XB7YB8XB8Y);
line(B8XB8YB1XB1Y);
setfillstyle(0xCC7B49);
floodfill(12*K15*K0xCC7B49);
//C區(qū)繪制
setcolor(0x0706F1);
int?C1X=15*KC1Y=8*K;
int?C2X=15*KC2Y=26*K;
int?C3X=16*KC3Y=19*K;
int?C4X=17*KC4Y=17*K;
int?C5X=18*KC5Y=15*K;
int?C6X=19*KC6Y=14*K;
int?C7X=20*KC7Y=13.5*K;
int?C8X=22*KC8Y=13*K;
int?C9X=22*KC9Y=4.5*K;
int?C10X=20*KC10Y=5*K;
int?C11X=18*KC11Y=6*K;
int?C12X=16*KC12Y=7*K;
line(C1XC1YC2XC2Y);
line(C2XC2YC3XC3Y);
line(C3XC3YC4XC4Y);
line(C4XC4YC5XC5Y);
line(C5XC5YC6XC6Y);
line(C6XC6YC7XC7Y);
line(C7XC7YC8XC8Y);
line(C8XC8YC9XC9Y);
line(C9XC9YC10XC10Y);
line(C10XC10YC11XC11Y);
line(C11XC11YC12XC12Y);
line(C12XC12YC1XC1Y);
setfillstyle(0x0706F1);
floodfill(20*K6*K0x0706F1);
//D區(qū)繪制
setcolor(0x44815D);
int?D1X=22.5*KD1Y=7.5*K;
int?D2X=22.5*KD2Y=13*K;
int?D3X=20*KD3Y=14*K;
int?D4X=19*KD4Y=15*K;
int?D5X=18*KD5Y=16*K;
int?D6X=17.5*KD6Y=17*K;
int?D7X=16*KD7Y=26*K;
int?D8X=17.5*KD8Y=20*K;
int?D9X=18*KD9Y=19*K;
int?D10X=19*KD10Y=18*K;
int?D11X=20*KD11Y=17*K;
int?D12X=21*KD12Y=16*K;
int?D13X=23*KD13Y=15*K;
int?D14X=25*KD14Y=14.5*K;
int?D15X=25*KD15Y=6*K;
line(D1XD1YD2XD2Y);
line(D2XD2YD3XD3Y);
line(D3XD3YD4XD4Y);
line(D4XD4YD5XD5Y);
line(D5XD5YD6XD6Y);
line(D6XD6YD7XD7Y);
line(D7XD7YD8XD8Y);
line(D8XD8YD9XD9Y);
line(D9XD9YD10XD10Y);
line(D10XD10YD11XD11Y);
line(D11XD11YD12XD12Y);
line(D12XD12YD13XD13Y);
line(D13XD13YD14XD14Y);
line(D14XD14YD15XD15Y);
line(D15XD15YD1XD1Y);
setfillstyle(0x44815D);
floodfill(20*K15*K0x44815D);
getch();
closegraph();
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????2864??2012-12-19?15:45??校徽.cpp
?????文件??????315445??2012-12-19?15:50??校徽.exe
評論
共有 條評論