2010-06-15 60 views
3

我有一個CGBitmapContext(bitmapContext),我想它的某些部分的矩形(RECT)繪製到電流CGContext上(上下文)。石英2D:從CGContext上拉伸到另一個CGContext上

現在我做到這一點的方法:

CGContextRef context = UIGraphicsGetCurrentContext(); 
CGImageRef cgImage = CGBitmapContextCreateImage(bitmapContext); 
CGContextClipToRect(context, rect); 
CGContextDrawImage(context, CGRectMake(0, 0, width, height), cgImage); 
CGImageRelease(cgImage); 

它是最佳的?什麼是最好的方式來做到這一點?

回答

2

另一種方法似乎是創建一個子圖像,我只能想象它不太理想。