Iphone CGImageRef:放大时如何获得更清晰的图像?
我需要在可缩放的PDF页面上绘制CGImageRef。 只要放大,一切看起来都很好。但我一放大,它就变得模糊了 有没有办法提高缩放图像的质量? 这是我的密码:Iphone CGImageRef:放大时如何获得更清晰的图像?,iphone,cocoa-touch,ios,ipad,cgimageref,Iphone,Cocoa Touch,Ios,Ipad,Cgimageref,我需要在可缩放的PDF页面上绘制CGImageRef。 只要放大,一切看起来都很好。但我一放大,它就变得模糊了 有没有办法提高缩放图像的质量? 这是我的密码: -(id)initWithRect:(CGRect)aRect andPage:(NSUInteger)aPage andAddressID:(NSString *)anID andTitle:(NSString *)aTitle visible:(BOOL)amIvis
-(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);
}
这就是图像缩小后的样子:
并放大:
谢谢你的帮助 可能的副本?谢谢你的想法!但我恐怕必须坚持使用CGImageRef,因为这正是我使用的PDF引擎所期望的。我想我必须以某种方式改进CGImageRef…请尝试将CGContextSetInterpolationQuality设置为kCGInterpolationNone。我清楚地记得,我曾尝试过加快速度,但令人惊讶的是,调整大小后的图像质量大幅提高。@TheBlack抱歉,但我已经尝试过了: