简体   繁体   中英

checking that the CAShapeLayer is in UIBezierPath

I have a problem. I created sinusoide using code: sinusoide and increased the thickness with path.lineWidth. I also added a dot to the screen (CAShapeLayer). I need to check if my dot is in the sinusoidal. I checked the available function UIBezierPath.contain. Unfortunately, it does not considering the lineWidth. I also checked by color if the pixel on the screen contains color but unfortunately it is very slow and takes 100% CPU. Whether there is any other quick way to find out if the dot is in the UIBezierPath?

Use copy(strokingWithWidth:lineCap:lineJoin:miterLimit:transform:) to create a stroked copy of the path. Then use contains on the copy to test the center of the dot.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM