使用 Raphael JS 从透明 PNG 创建路径/图像映射

发布于 2024-09-11 19:02:08 字数 248 浏览 3 评论 0原文

我正在开发一个 Raphael JS 项目,需要显示一些透明的 PNG,其中只有不透明的部分可单击。有没有办法:

I'm working on a Raphael JS project and need to display some transparent PNGs with only the parts that are non-transparent to be clickable. Is there a way to:

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

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

发布评论

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

评论(1

紅太極 2024-09-18 19:02:08

由于 raphael 用于矢量图形,因此它对于解决 png 问题来说是错误的工具。我认为画布正是您所寻找的。 将图像加载到画布中(画布不需要推入DOM)。单击后检查坐标并从画布中获取像素

但也许将 png 转换为矢量图形并使用 raphael 会更容易。

As raphael is for vector graphics, it is the wrong tool for your problem with png. I think canvas is what you looking for. Load your image in an canvas (the canvas doesent need to be pushed in the DOM). On click check the coords and get the pixel out of the canvas.

But maybe it will be easier to convert you png to vector graphics and use raphael instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文