我需要在可缩放的PDF页面上绘制CGImageRef。 只要它缩小,一切看起来都很好。但是当我放大时,它当然会变得模糊不清。
有没有办法提高缩放图像的质量? 这是我的代码:
-(id)initWithRect:(CGRect)aRect
andPage:(NSUInteger)aPage
andAddressID:(NSString *)anID
andTitle:(NSString *)aTitle
visible:(BOOL)amIvisible{
self = [super init];
if(self) {![enter image description here][1]
self.highlightRect = aRect;
self.page = aPage;
self.addressID = anID;
self.title = aTitle;
icon = [UIImage imageNamed:@"test.png"];
self.visible = amIvisible;
}
return self;
}
-(void) drawInContext:(CGContextRef)context{
CGRect imageRect = CGRectMake((highlightRect.origin.x + (highlightRect.size.width/2) -16),
highlightRect.origin.y-40,
36,
25);
CGImageRef iconRef = [icon CGImage];
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
if(visible)
CGContextDrawImage(context,imageRect,iconRef);
}
这就是图像缩小的结果:
放大:
感谢您的帮助!