0

このコードは、アプリで描画するために使用します。そのため、アルファ プロパティ = 1 で描画すると問題が発生します。これは非常に優れていますが、アルファ プロパティ = 0.2 に変更すると、ペイントがうまくいきません。alpha プロパティ = 0.2 でより良くするにはどうすればよいですか。

http://www.flickr.com/photos/9601621@N05/page1/

α=1で描く:良い α=0.2で描く:悪い

    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
 if ([self.view superview] && (headerView.frame.origin.y == -30)) {
  mouseSwiped = YES;

  UITouch *touch = [touches anyObject]; 
  CGPoint currentPoint = [touch locationInView:self.view];
  currentPoint.y -= 20;



  UIGraphicsBeginImageContext(self.view.frame.size);

  CGContextRef context = UIGraphicsGetCurrentContext();

  [drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
  CGContextSetLineCap(context, kCGLineCapRound);
  CGContextSetLineWidth(context, currentBrushProperty.brushSize);
  CGContextSetRGBStrokeColor(context, [self red], [self green], [self blue], currentBrushProperty.brushTransparency);
  CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0);

  CGContextBeginPath(context);
  CGContextMoveToPoint(context, lastPoint.x, lastPoint.y);
  CGContextAddLineToPoint(context, currentPoint.x, currentPoint.y);

  CGContextStrokePath(context);
  drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();

  lastPoint = currentPoint;

 }}
4

1 に答える 1

0

あなたの問題は、一連の半透明の円を描いていることです-タッチが登録されている場所ごとに1つずつ。最も簡単な解決策は、100% のアルファで描画してから、色付き領域のアルファを必要なアルファに調整することです。

于 2010-05-14T15:39:42.287 に答える