我正在制作一个小项目,可以放大图像并从放大镜中选择像素的颜色,现在我可以放大图像的触摸位置,但是放大镜显示的像素具有模糊效果,我该怎么做没有任何模糊处理,非常清楚地显示像素点?
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect bounds = self.bounds;
CGImageRef mask = [UIImage imageNamed: @"loupe-mask@2x.png"].CGImage;
UIImage *glass = [UIImage imageNamed: @"loupe-hi@2x.png"];
CGContextSaveGState(context);
CGContextClipToMask(context, bounds, mask);
CGContextFillRect(context, bounds);
CGContextScaleCTM(context, 40, 40);
//draw your subject view here
CGContextTranslateCTM(context,1*(self.frame.size.width*0.5),1*(self.frame.size.height*0.5));
//CGContextScaleCTM(context, 1.5, 1.5);
CGContextTranslateCTM(context,-1*(touchPoint.x),-1*(touchPoint.y));
[self.viewToMagnify.layer renderInContext:context];
CGContextRestoreGState(context);
[glass drawInRect: bounds];
}
应该:
不该是: