[英]drawAtPoint with rotation
我無法使用drawAtPoint
在正確的位置繪制drawAtPoint
。 在應用程序中我使用CGAffineTransformMakeRotation
來旋轉圖像視圖,但是當我想使用UIGraphicsGetImageFromCurrentImageContext
將UIGraphicsGetImageFromCurrentImageContext
保存為與其他人合並的一部分時,我不知道如何告訴它旋轉..我所做的就是旋轉180度。 這是我用來將它與另一個圖像合並的代碼。
UIGraphicsBeginImageContext(imageView.bounds.size);
[imageView.image drawAtPoint:CGPointMake(-40,0)];
[topView.image drawAtPoint:CGPointMake(0,160)];
UIImage *mergedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
所以我的問題是:我如何drawAtPoint
180度或3.14159265弧度旋轉?
提前致謝。
您可以對圖像內容應用變換,因此將使用該變換繪制所有后續繪制操作,例如(未經測試)
UIGraphicsBeginImageContext(size);
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextRotateCTM(c, M_PI/6);
[image drawAtPoint:CGPointZero];
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.