imageantalias($img, false) 的用例是什么
我不明白为什么在 PHP
中使用 imageantalias
函数时,您需要传入一个 Bool 来表示是否要启用抗锯齿功能。
调用带有参数的函数来表示不执行任何操作,这感觉是违反直觉的。
是否有一个用例可以用 false 来调用它,而我却错过了?
I don't understand why in PHP
when using the imageantialias
function you need to pass in a Bool to say if you want to enable anti-aliasing or not.
It feels counter intuitive to call a function with a parameter to say don't do anything.
Is there a use case for calling it with false that I am missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
传递 false 并不告诉函数什么都不做,而是关闭抗锯齿功能(如果它已打开)。一个用例是绘制具有抗锯齿功能的图像,稍后又想在不使用抗锯齿功能的情况下绘制更多图像。
Passing false doesn't tell the function to do nothing, but to turn antialiasing off, if it was on. A usecase would be drawing to an image with antialiasing, later wanting to draw some more without antialiasing.
这是一个启用/禁用功能。
因此,如果我调用:
...则为
$image
启用抗锯齿功能。如果我随后打电话:我已再次禁用它。
This is an enable/disable function.
So if I call:
...then anti-aliasing is enabled for
$image
. And if I then call:I have disabled it again.