开发者

PDF Making with Rotated Image for iPhone

I'm having problems with drawing rota开发者_StackOverflowted images on PDF, my output is worse.

My case is, we don't know have any fixed co-ordinates. X,Y, rotation, etc. depends on ImageView itself. I select the ImageView and rotate it through Sliders.

Check on ZOSH application. I need to implement functionalities like that app. I want to make PDF by adding images one by one.

Please send me link for any example that can help me out, I'm stuck here. I'm drawing the image on PDF based on center of the imageview.

Please help me, Thank You.


Was having the same problem,after a fair amount of time i was able to find a solution....might be helpful to you

-(UIImage*)RotateImage:(UIImage*)Image :(float)Angle { CGFloat angleInRadians =-1*Angle* (M_PI / 180.0); CGAffineTransform transform=CGAffineTransformIdentity;

transform = CGAffineTransformMakeRotation(angleInRadians);
//transform = CGAffineTransformMakeScale(1, -1);
//transform =CGAffineTransformMakeTranslation(0,80);

CGRect rotatedRect = CGRectApplyAffineTransform(CGRectMake(0,0,Image.size.width,Image.size.height), transform);

UIGraphicsBeginImageContext(rotatedRect.size);
//[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0,rotatedRect.size.height);
CGContextScaleCTM(UIGraphicsGetCurrentContext(),1, -1); 

//CGContextTranslateCTM(UIGraphicsGetCurrentContext(), +(rotatedRect.size.width/2),+(rotatedRect.size.height/2));

CGContextTranslateCTM(UIGraphicsGetCurrentContext(), (rotatedRect.origin.x)*-1,(rotatedRect.origin.y)*-1);
CGContextRotateCTM(UIGraphicsGetCurrentContext(), angleInRadians);
//CGContextTranslateCTM(UIGraphicsGetCurrentContext(), -(rotatedRect.size.width/2),-(rotatedRect.size.height/2));

CGImageRef temp = [Image CGImage];

CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, Image.size.width,Image.size.height), temp);

//CGContextRotateCTM(UIGraphicsGetCurrentContext(), -angleInRadians);

UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

//[viewImage autorelease];


return viewImage;

}

for Zooming issues....i suggest you try to make a subclass for the application window

I found this web page that shows how to subclass the application window so as to observe taps and forward those taps to the view controller.

http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/

Hope that helps you...


The answer is in Apple's documentation. Listings 13-3 and 13-4 seems like what you are after.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜