確定,所以這裏是我想做的事:如何擴大含CGContextDrawPDFPage在可可觸摸繪製的基於矢量的圖形一個PDF
- 負載包含矢量圖形
- 將其放大PDF文件
- 它繪製到圖形上下文
- 從結果中創建一個UIImage並將其顯示
一切工作正常,但事實該圖形失去質量和像素化外觀:(
這裏就是縮放發生代碼:
// PDF loaded before
CGPDFPageRef page = CGPDFDocumentGetPage (document, 1);
UIGraphicsBeginImageContext(CGSizeMake(width, height));
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGRect rect = CGPDFPageGetBoxRect(page, kCGPDFCropBox);
float widthFactor = width/ rect.size.width;
float heightFactor = height/ rect.size.height;
CGAffineTransform pdfTransform2 = CGAffineTransformMakeScale (widthFactor, heightFactor);
CGContextConcatCTM(context, pdfTransform2);
CGContextDrawPDFPage(context, page);
CGContextRestoreGState(context);
retValue = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
我認爲問題是,我只能重新調整的背景下,而不是實際的PDF。有沒有其他方式可以做到這一點,而不會有質量損失?
非常感謝您的任何提示!
你有沒有想過這個? – Kalle 2010-08-30 19:27:50