我想将 CGContextRef 的内容旋转 -90 度。我找到了一些代码,但它无法正常工作。
CGContextRef tempColorRef = CGBitmapContextCreate(NULL, width, height, bitsPerComponent,
bytesPerRow, colorspace,
kCGImageAlphaPremultipliedLast);
CGImageRef colorImageRef = CGBitmapContextCreateImage(colorContextRef);
CGContextTranslateCTM(tempLayerRef, width / 2, height / 2);
CGContextRotateCTM(tempLayerRef, DegreesToRadians(-90));
CGContextScaleCTM(tempColorRef, 1.0, -1.0);
CGContextDrawImage(tempColorRef, CGRectMake(-width / 2, -height / 2, width, height), colorImageRef);
CGImageRelease(colorImageRef);
colorContextRef = tempColorRef;
请任何人帮助我。