-1
내 UIImage
의 영역 색상을 CGContext
으로 변경하려고하고 있으며 현재 상태에서 새 이미지를 만듭니다. 원본 이미지의 방향이 올바르지 만 이미지가 옆으로 바뀝니다.CGContextDrawImage가 내 이미지를 회전하는 이유
CGRect imageRect = CGRectMake(0, 0, originalImage.size.width, originalImage.size.height);
UIGraphicsBeginImageContextWithOptions(originalImage.size, false, originalImage.scale);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextDrawImage(context, imageRect, originalImage.CGImage);
CGContextSetRGBFillColor(context, 255.0f, 255.0f, 255.0f, 1.0f);
CGContextFillRect(context, CGRectMake(5,5,100,100));
CGContextRotateCTM (context, radians(270));
CGContextRestoreGState(context);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();