实例讲述PHP实现中秋博饼游戏之绘制骰子图案功能
2018-06-22 00:59:02来源:未知 阅读 ()
![新老客户大回馈,云服务器低至5折](/info/templets/default/images/760x90_D.jpg)
本文实例讲述了php.html" target="_blank">php实现的中秋博饼游戏之绘制骰子图案功能。分享给大家供大家参考,具体如下:
最近公司中秋博饼(在厦门),自己没事也想玩玩,所以就想动手写了一个纯php实现的中秋博饼游戏,既然要纯php实现,就要用php来生成图案,所以第一步就先绘制骰子图案。
平时很少使用php绘图,不过查查资料还是绘制出来了,不多说了,代码如下:
header('Content-Type:image/png'); $img = imagecreatetruecolor(200, 200); $white = imagecolorallocate($img, 255, 255, 255); $grey = imagecolorallocate($img, 100, 100, 100); $blue = imagecolorallocate($img, 0, 102, 255); $red = imagecolorallocate($img, 255, 0, 0); imagefill($img, 0, 0, $white); imageline($img, 10, 20, 10, 180, $grey); imageline($img, 10, 180, 20, 190, $grey); imageline($img, 20, 190, 180, 190, $grey); imageline($img, 180, 190, 190, 180, $grey); imageline($img, 190, 180, 190, 20, $grey); imageline($img, 190, 20, 180, 10, $grey); imageline($img, 180, 10, 20, 10, $grey); imageline($img, 20, 10, 10, 20, $grey); //1 imagefilledarc($img, 100, 100, 50, 50, 0, 0, $blue, IMG_ARC_PIE); //2 //imagefilledarc($img, 60, 100, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //imagefilledarc($img, 140, 100, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //3 //imagefilledarc($img, 50, 50, 40, 40, 0, 0 , $blue, IMG_ARC_PIE); //imagefilledarc($img, 100, 100, 40, 40, 0, 0 , $blue, IMG_ARC_PIE); //imagefilledarc($img, 150, 150, 40, 40, 0, 0 , $blue, IMG_ARC_PIE); //4 //imagefilledarc($img, 50, 50, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //imagefilledarc($img, 50, 150, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //imagefilledarc($img, 150, 150, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //imagefilledarc($img, 150, 50, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //5 //imagefilledarc($img, 50, 50, 40, 40, 0, 0 , $blue, IMG_ARC_PIE); //imagefilledarc($img, 50, 150, 40, 40, 0, 0 , $blue, IMG_ARC_PIE); //imagefilledarc($img, 100, 100, 40, 40, 0, 0 , $blue, IMG_ARC_PIE); //imagefilledarc($img, 150, 150, 40, 40, 0, 0 , $blue, IMG_ARC_PIE); //imagefilledarc($img, 150, 50, 40, 40, 0, 0 , $blue, IMG_ARC_PIE); //6 //imagefilledarc($img, 50, 50, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //imagefilledarc($img, 50, 150, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //imagefilledarc($img, 100, 50, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //imagefilledarc($img, 100, 150, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //imagefilledarc($img, 150, 150, 40, 40, 0, 0 , $red, IMG_ARC_PIE); //imagefilledarc($img, 150, 50, 40, 40, 0, 0 , $red, IMG_ARC_PIE); imagepng($img); imagedestroy($img);
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- PHP写UltraEdit插件脚本实现方法 2020-03-29
- php 带逗号千位符数字的处理方法 2020-03-28
- PHP三元运算符的结合性介绍 2020-03-28
- PHP静态延迟绑定和普通静态效率的对比 2020-03-28
- 基于php流程控制语句和循环控制语句 2020-03-28
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash