簡體   English   中英

drawAtPoint與旋轉

[英]drawAtPoint with rotation

我無法使用drawAtPoint在正確的位置繪制drawAtPoint 在應用程序中我使用CGAffineTransformMakeRotation來旋轉圖像視圖,但是當我想使用UIGraphicsGetImageFromCurrentImageContextUIGraphicsGetImageFromCurrentImageContext保存為與其他人合並的一部分時,我不知道如何告訴它旋轉..我所做的就是旋轉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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM