drawing UIImage inside a CGMutablePath

后端 未结 2 362
我寻月下人不归
我寻月下人不归 2021-01-21 11:27

Given a CGMutablePathRef how do I draw a UIImage in it? I know that you can draw it like the following:

 UIImage* scaledImage = UIGraphicsGetImageFromCurrentImag         


        
2条回答
  •  既然无缘
    2021-01-21 11:56

    When you say "draw within a CGMutablePath" I have to assume you mean "clip to a CGMutablePath." In that case, you just need to add the path to the current context (CGContextAddPath() or any of the path-building functions like CGContextAddLineToPoint()) and then call CGContextClip(). You can then draw your image in the context with something like drawAtPoint: or CGContextDrawImage().

提交回复
热议问题