如何在PHP中绘制2D几何对象(圆形,多边形...) [英] How to draw 2d geometric object (circle, polygon...) in php

查看:91
本文介绍了如何在PHP中绘制2D几何对象(圆形,多边形...)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建非常简单的 2d几何对象,例如圆形和多边形.并像图像一样将其打印到屏幕上. 我该如何使用 PHP ? 也许使用PHP Gd,那又如何?

I want to create very simple 2d geometric object like circles and polygon. And print it to the screen like an image. How can i do with PHP ? Maybe with PHP Gd, then how ?

推荐答案

有一些本机PHP函数可以执行此操作,但是您实际上不应该在PHP中执行此操作.

There are a few native PHP functions to do this, but you really shouldn't be doing this in PHP.

您将需要通过创建空白图像画布. imagecreatetruecolor,将其保存到服务器目录中,并使用某些本机映像功能(例如imagefilledpolygon)进行填充. PHP内置了您可以使用的imagefilled___函数.

You would need to create a blank image canvas via. imagecreatetruecolor, save it into the the directory of the server and fill it using some native image function such as imagefilledpolygon. PHP has built in imagefilled___ functions you can use.

http://php.net/manual/en/function.imagefilledpolygon.php

这篇关于如何在PHP中绘制2D几何对象(圆形,多边形...)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆