画像を拡大し、拡大鏡からピクセルの色を選択する機能を提供する小さなプロジェクトを作成しています。これで、画像のタッチした場所を拡大できますが、拡大鏡はぼやけた効果でピクセルを表示します。どうすれば作成できますかファジー処理なしでピクセルを1つずつ非常に明確に表示しますか?
- (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];
}
次のようにする必要があります。
あってはなりません: