iPhone-如何在另一张CGImage上绘制CGImage

iPhone-如何在另一张CGImage上绘制CGImage,iphone,core-graphics,Iphone,Core Graphics,我是否需要图形,然后使用CGContextDrawImage()或者我可以用另一种方法吗 创建一个上下文。(例如,位图上下文CGBitmapContextCreate) 使用CGContextDrawImage绘制图像A 使用CGContextDrawImage绘制图像B 使用CGBitmapContextCreateImage获取合成图像(如果使用位图上下文) 此博客文章有一个代码示例: - (UIImage*) getImage { CGImage imgA = ....

我是否需要图形,然后使用
CGContextDrawImage()或者我可以用另一种方法吗

  • 创建一个上下文。(例如,位图上下文CGBitmapContextCreate)
  • 使用CGContextDrawImage绘制图像A
  • 使用CGContextDrawImage绘制图像B
  • 使用CGBitmapContextCreateImage获取合成图像(如果使用位图上下文)
  • 此博客文章有一个代码示例:

    - (UIImage*) getImage {
    
        CGImage imgA = ....
        CGImage imgB = ....
    
        // ...
    
        //  I want to draw imgA onto imgB and return the result