Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone CGImageRef:放大时如何获得更清晰的图像?_Iphone_Cocoa Touch_Ios_Ipad_Cgimageref - Fatal编程技术网

Iphone 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

我需要在可缩放的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);
}
这就是图像缩小后的样子:

并放大:


谢谢你的帮助

可能的副本?谢谢你的想法!但我恐怕必须坚持使用CGImageRef,因为这正是我使用的PDF引擎所期望的。我想我必须以某种方式改进CGImageRef…请尝试将CGContextSetInterpolationQuality设置为kCGInterpolationNone。我清楚地记得,我曾尝试过加快速度,但令人惊讶的是,调整大小后的图像质量大幅提高。@TheBlack抱歉,但我已经尝试过了: