当前位置: 首页 > news >正文

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);

本文实例讲述了php实现的中秋博饼游戏之绘制骰子图案功能。分享给大家供大家参考,具体如下:

最近公司中秋博饼(在厦门),自己没事也想玩玩,所以就想动手写了一个纯php实现的中秋博饼游戏,既然要纯php实现,就要用php来生成图案,所以第一步就先绘制骰子图案。

平时很少使用php绘图,不过查查资料还是绘制出来了,不多说了,代码如上:

http://www.lryc.cn/news/95009.html

相关文章:

  • erlang 虚拟机优化参数
  • 网络安全能力成熟度模型介绍
  • python爬虫试手
  • pandas 笔记:pivot_table 数据透视表
  • C#(六十)之Convert类 和 Parse方法的区别
  • 暑期代码每日一练Day3:874. 模拟行走机器人
  • 肖sir___环境相关的面试题
  • 代理IP、Socks5代理和SK5代理的前沿技术与未来发展趋势
  • VM(CentOS7安装和Linux连接工具以及换源)
  • 阿里云斩获 4 项年度云原生优秀案例丨阿里云云原生 6 月动态
  • dede图片集上传图片时出错显示FILEID的解决办法
  • 【亲测有效】 通过mysql指令 导出数据库中表名 和 表名的备注
  • 【Nginx08】Nginx学习:HTTP核心模块(五)长连接与连接处理
  • 第八十五天学习记录:C++核心:内存分区模型
  • Chrome远程调试webview
  • 爬虫与反爬虫的攻防对抗
  • 【机器学习】特征工程 - 字典特征提取
  • 用户交互----进入游戏
  • 排序算法 - 快速排序(4种方法实现)
  • C++入门知识点
  • 开眼界了,AI绘画商业化最强玩家是“淘宝商家”
  • 机器学习与深度学习——自定义函数进行线性回归模型
  • 大屏项目也不难
  • c#webclient请求中经常出现的几种异常
  • 设计模式-原型模式
  • sentinel介绍-分布式微服务流量控制
  • 基于Redisson的Redis结合布隆过滤器使用
  • BrowserRouter刷新404解决方案
  • 解决appium-doctor报opencv4nodejs cannot be found
  • 安卓通过adb pull和adb push 手机与电脑之间传输文件