0
我想用-90度旋轉CGContextRef的內容。 我發現了一些代碼,但它無法正常工作。CGContextRef旋轉不起作用
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;
任何人都可以幫助我。
「不能正常工作」是什麼意思?你遇到鼻子惡魔還是什麼? – 2012-09-22 08:30:38
內容已經消失。 –
我敢肯定,數學部分是搞砸了,你正在繪製*在上下文之外。如果你移除秤部分會怎麼樣? – 2012-09-22 10:13:06