0
可能重複:
How to merge two images after rotate the image?如何合併旋轉圖像和背景圖片?
我用兩個圖像的前景圖像旋轉,背景圖像是穩定的。如何合併這兩個圖像?它不適合我工作。提前致謝。
UIGraphicsBeginImageContext(itemSize);
CGRect backgroundImageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
CGRect foregroundImageRect = CGRectMake(rsImageView.frame.origin.x, rsImageView.frame.origin.y, rsImageView.frame.size.width, rsImageView.frame.size.height);
[backgroundImageView.image drawInRect:backgroundImageRect];
[rsImageView.image drawInRect:foregroundImageRect];
overlappedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
我正在使用此代碼。但不能合併旋轉圖像。它只合並最後一個圖像幀。
你嘗試過什麼?你失敗了嗎?什麼是錯誤?你的代碼是什麼? –
UIGraphicsBeginImageContext(itemSize); 的CGRect backgroundImageRect = CGRectMake(0.0,0.0,itemSize.width,itemSize.height); 的CGRect foregroundImageRect = CGRectMake(rsImageView.frame.origin.x,rsImageView.frame.origin.y,rsImageView.frame.size.width,rsImageView.frame.size.height); [backgroundImageView.image drawInRect:backgroundImageRect]; [rsImageView.image drawInRect:foregroundImageRect]; overlappedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();我試過這樣。但旋轉圖像沒有正確合併。 – Mani
請修改您的問題,而不是在評論中發佈大量代碼。謝謝! –