如何去除ImageFilledPolygon php锯齿状边缘?

发布于 2024-12-02 10:36:23 字数 428 浏览 3 评论 0原文

我有一个函数可以填充 imagecreatetruecolor($h,$w) 创建的位图的一部分; 但结果是绘图看起来锯齿状且不平滑,这很糟糕。 我尝试了 php antialias(resource,boolean) 函数,没有区别。我只能猜测它不受支持。 任何大师都知道有什么巧妙的技巧可以使边缘光滑吗? 如果你看图片 http://www.php.net/manual/en/images/21009b70229598c6a80eef8b45bf282b-imagefilledpolygon.png 从php手册来看,这正是我的意思。有什么想法如何去除它(锯齿状边缘)? 非常感谢。

I have a function that fills a part of the bitmap created by imagecreatetruecolor($h,$w) ;
But the result is the drawing looking jagged and not smooth which sucks.
I tried the php antialias(resource,boolean) function and there is no difference. I can only guess it isn't supported.
Any gurus know of any neat trick to make the edges smooth?
If you look at the image
http://www.php.net/manual/en/images/21009b70229598c6a80eef8b45bf282b-imagefilledpolygon.png
from the php manual, that is exactly what I mean. Any ideas how to remove it (the jagged edges)?
Thanks a lot in advanced.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鹤仙姿 2024-12-09 10:36:23

为了使边缘平滑,可以尝试resizeimage函数并添加模糊参数。

To make the edges smooth, you can try the resizeimage function and add a blur parameter.

夜清冷一曲。 2024-12-09 10:36:23

@trimbo 指出 2006 年在 php.net 上:

您仍然可以通过绘制空心来绘制抗锯齿填充多边形
多边形位于具有相同尺寸的填充多边形之上:

$points=array($x,$y, $x2,$y2, $x3,$y3);
imageFilledPolygon($im, $points, 3, $gray );
imagePolygon($im, $points, 3, $gray );

@trimbo pointed out in 2006 on php.net:

You can still draw antialiased filled polygons by drawing a hollow
polygon on top of a filled one with the same dimensions:

$points=array($x,$y, $x2,$y2, $x3,$y3);
imageFilledPolygon($im, $points, 3, $gray );
imagePolygon($im, $points, 3, $gray );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文