CGContext rotation
- by kasperjj
I have a 100x100 pixel image that I want to draw at various angles rotated around the center of the image. The following code works, but rotates around the original origo of the coordinate system (upper left hand corner) and not the translated location. Thus the image is not rotated around itself but around the upper left corner of the screen.
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, -50, -50);
CGContextRotateCTM (context, 0.3);
CGContextTranslateCTM(context,768/2,1024/2);
[image drawAtPoint:CGPointMake(0,0)];
I tried doing the same using CGAffineTransform, but got the same results.