PHP/GD,如何将圆从一张图像复制到另一张图像?
是否有一种相当简单的方法将圆形区域从一个图像资源复制到另一个图像资源? 类似 imagecopymerge 的东西,除了圆形或椭圆形等?
如果可能的话,我想避免使用预先创建的图像文件(任何椭圆形都可以),并且如果涉及透明颜色,它们自然应该保留图像的其余部分。
我问的原因是,我有一些类允许在图像的“选定区域”内应用图像操作,其工作原理是首先从图像副本中删除该区域,然后将副本覆盖回原始图像上。 但是,如果您想选择一个矩形,然后在其中取消选择一个圆形,并且操作仅影响剩下的区域,该怎么办?
Is there a reasonably straightforward way to copy a circular area from one image resource to another? Something like imagecopymerge except with circles or ovals etc?
If possible, I want to avoid having to use pre-created image files (any oval shape should be possible), and if there's transparency colours involved they should naturally leave the rest of the image alone.
Reason I'm asking, I have a few classes that allow to apply image operations inside a "selected area" of an image, which works by first deleting that area from a copy of the image, then overlaying the copy back on the original. But what if you want to select a rectangle, and then inside that deselect a circle, and have the operations only affect the area that's left?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试以下操作:
You could try this: