iOS uygulamasında CoreGraphics kullanarak eğriler çizmeye çalışıyorum. Çizimin kendisi iyi çalışıyor, ancak retina ekranda görüntü aynı çözünürlüğü kullanarak çiziliyor ve piksel ikiye katlanmıyor. Sonuç pikselli bir görüntüdür.CoreGraphics kullanarak retina ekranında çizim - Resim pixelated
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self.canvasView];
UIGraphicsBeginImageContext(self.canvasView.frame.size);
[canvasView.image drawInRect:self.canvasView.frame];
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSetShouldAntialias(ctx, YES);
CGContextSetLineCap(ctx, kCGLineCapRound);
CGContextSetLineWidth(ctx, 5.0);
CGContextSetRGBStrokeColor(ctx, 1.0, 0.0, 0.0, 1.0);
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(ctx, currentPoint.x, currentPoint.y);
CGContextStrokePath(ctx);
canvasView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
lastPoint = currentPoint;
// some code omitted from this example
}
buldum tavsiye use the scaleFactor
property veya CGContextSetShouldAntialias()
function oldu, ama bunların hiçbiri bugüne kadar yardım etti:
aşağıdaki işlevleri kullanarak çiziyorum. (Bunları yanlış kullanmış olmama rağmen.)
Herhangi bir yardım büyük memnuniyetle karşılanacaktır.
Mükemmel çalışıyor! Teşekkür ederim! – antalkerekes