问题描述
我想创建非常简单的 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几何对象(圆形,多边形...)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!