Why does CGPDFPageGetDrawingTransform() crash with SIGABRT when specifying a rotation?

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-06-05T17:48:15Z Indexed on 2010/06/05 17:52 UTC
Read the original article Hit count: 310

Filed under:
|

When I call CGPDFPageGetDrawingTransform() with a rotation argument, the application crashes. If I specify no rotation, there is no crash.

Here is my drawLayer:inContext: method:

- (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context
{
CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0);
    CGRect boundingBox = CGContextGetClipBoundingBox(context); 
    CGContextFillRect(context, boundingBox);

    //convert to UIKit native coodinate system
    CGContextTranslateCTM(context, 0.0, self.bounds.size.height);
CGContextScaleCTM(context, 1.0, -1.0);

    //Rotate the pdf_page
    CGAffineTransform pfd_transform = CGPDFPageGetDrawingTransform(self.page, kCGPDFCropBox, self.frame, 58.46f, true);

    CGContextSaveGState (context);
    CGContextConcatCTM (context, pfd_transform);
    CGContextClipToRect (context, self.frame);
    CGContextDrawPDFPage (context, self.page);
    CGContextRestoreGState (context);
}

In the long run, I would like to rotate the pdf dynamically to follow a users heading. Maybe I am going at this all wrong...

Thank you for your time.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about coregraphics