分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

php代码画足球场

发布时间:2023-09-06 01:06责任编辑:白小东关键词:暂无标签

用代码画了个足球场

原图:

代码画出的效果图:

代码如下:

// 创建一个 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代码画足球场

原文地址:http://www.cnblogs.com/phonecom/p/7442254.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved