W mojej aplikacji iOS próbuję rysować krzywe za pomocą CoreGraphics. Sam rysunek działa dobrze, ale na ekranie siatkówki obraz zostanie narysowany przy użyciu tej samej rozdzielczości i nie zostanie podwojony. Rezultatem jest pikselowany obraz.Rysowanie na wyświetlaczu siatkówki za pomocą CoreGraphics - Image pixelated
jestem rysunek za pomocą następujących funkcji:
- (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
}
Porady znalazłem było use the scaleFactor
property, albo CGContextSetShouldAntialias()
function, ale żadna z nich nie pomógł tak daleko. (Chociaż mogłem ich używać nieprawidłowo.)
Każda pomoc byłaby bardzo doceniana.
Działa doskonale! Dziękuję Ci! – antalkerekes