【问题标题】:iPhone - How do I draw a CGImage on anouther CGImageiPhone - 如何在另一个 UIImage 上绘制 UIImage
【发布时间】:2011-02-04 17:57:55
【问题描述】:
- (UIImage*) getImage {

    CGImage imgA = ....
    CGImage imgB = ....

    // ...

    //  I want to draw imgA onto imgB and return the result

我需要一个图形然后使用CGContextDrawImage(); 还是可以用其他方式?

【问题讨论】:

    标签: iphone core-graphics


    【解决方案1】:
    1. 创建上下文。 (例如,位图上下文 CGBitmapContextCreate)
    2. 使用 CGContextDrawImage 绘制图像 A
    3. 使用 CGContextDrawImage 绘制图像 B
    4. 使用 CGBitmapContextCreateImage 获取合成图像(如果您使用的是位图上下文)

    这篇博文有一个代码示例:
    http://www.realdevelopers.com/blog/code/compositing-two-uiimages-in-objective-c

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多