从黑白位图图像中提取路径信息

编程入门 行业动态 更新时间:2024-10-28 01:13:36
本文介绍了从黑白位图图像中提取路径信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用 Quartz 2D 绘制形状以描绘如下图像并不容易。是否可以从黑白位图图像中提取 CGPathRef 信息?白色部分实际上是透明的。

It is not easy to draw a shape with Quartz 2D to depict an image as following. Is it possible to extract a CGPathRef information from a black&white bitmap image? The white part is actually transparent.

编辑:

我想要实现的目标:

我想设置 SKSpriteNode 的 physicsBody 相同形状的图像 bottle.png

I want to set the physicsBody of a SKSpriteNode with the same shape of the image bottle.png

SKSpriteNode * myBottle = [SKSpriteNode spriteNodeWithImageNamed:@"bottle"]; . . . myBottle.physicsBody = [SKPhysicsBody bodyWithEdgeChainFromPath:path];

她的路径是 CGPathRef ,我想让它与图像具有相同的形状 bottle.png

Her path is a CGPathRef, I wanna to make it have the same shape with the image bottle.png

推荐答案

Google potrace 这是执行此操作的几个开源库之一。 它还可以轻松链接到其他人。

Google potrace It's one of several open source libraries that do this. It also handily links to others.

更多推荐

从黑白位图图像中提取路径信息

本文发布于:2023-10-29 22:48:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1540993.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:位图   路径   黑白   图像   信息

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!