php代碼畫足球場

來源:互聯網
上載者:User

標籤:輸出   hit   瀏覽器   nbsp   des   line   php   logs   log   

 

用代碼畫了個足球場

原圖:

 

代碼畫出的:

 

代碼如下:

// 建立一個 200X200 的映像$img = imagecreate(800, 500);// 分配顏色$bg = imagecolorallocate($img, 0, 120, 0);$white = imagecolorallocate($img, 255, 255, 255);$black = imagecolorallocate($img, 0, 0, 0);// 填充背景色imagefill($img, 800, 500, $bg);// 畫線// 四邊imageline($img, 25, 25, 775, 25, $white);imageline($img, 25, 475, 775, 475, $white);imageline($img, 25, 25, 25, 475, $white);imageline($img, 775, 25, 775, 475, $white);// 中分線imageline($img, 400, 25, 400, 475, $white);// 中分點imagesetpixel($img, 400, 250, $white);imagesetpixel($img, 399, 250, $white);imagesetpixel($img, 401, 250, $white);imagearc($img, 400, 250, 4, 4, 0, 360, $white);// 中分圓imagearc($img, 400, 255, 150, 150, 0, 360, $white);// 左球門imageline($img, 25, 175, 65, 175, $white);imageline($img, 25, 325, 65, 325, $white);imageline($img, 65, 175, 65, 325, $white);imageline($img, 25, 105, 155, 105, $white);imageline($img, 25, 395, 155, 395, $white);imageline($img, 155, 105, 155, 395, $white);imagesetpixel($img, 120, 250, $white);imagearc($img, 120, 250, 4, 4, 0, 360, $white);imagearc($img, 155, 250, 50, 125, 270, 450, $white);// 右球門imageline($img, 735, 175, 775, 175, $white);imageline($img, 735, 325, 775, 325, $white);imageline($img, 735, 175, 735, 325, $white);imageline($img, 775, 105, 650, 105, $white);imageline($img, 775, 395, 650, 395, $white);imageline($img, 650, 105, 650, 395, $white);imagesetpixel($img, 680, 250, $white);imagearc($img, 680, 250, 4, 4, 0, 360, $white);imagearc($img, 650, 250, 50, 125, 90, 270, $white);// 兩邊小長方形imageline($img, 25, 225, 20, 225, $white);imageline($img, 25, 275, 20, 275, $white);imageline($img, 20, 225, 20, 275, $white);imageline($img, 775, 225, 780, 225, $white);imageline($img, 775, 275, 780, 275, $white);imageline($img, 780, 225, 780, 275, $white);// 四個角imagearc($img, 25, 25, 23, 23, 0, 90, $white);imagearc($img, 775, 25, 23, 23, 90, 180, $white);imagearc($img, 25, 475, 23, 23, 270, 360, $white);imagearc($img, 775, 475, 23, 23, 180, 270, $white);// 將映像輸出到瀏覽器header("Content-type: image/png");imagepng($img);// 釋放記憶體imagedestroy($img);

 

php代碼畫足球場

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.