RFG
RFG

Reputation: 2902

UIBezierPath strokecolor outline when drawing

I'm doing some tests with freehand drawing for an App. I've implemented a line draw and and erase draw method.

- (void)drawRect:(CGRect)rect
{
    [self.addingImage drawInRect:rect];
    [self.path stroke];
    self.path.lineCapStyle = kCGLineCapRound;

    if (self.isEraseMode)
    {
        [[UIColor clearColor] setStroke];
        [self.path setLineWidth:self.eraseWidth];
        [self.path strokeWithBlendMode:kCGBlendModeClear alpha:1.0];
    }
    else
    {
        [self.strokeColor setStroke];
        [self.path setLineWidth:self.strokeWidth];
        [self.path strokeWithBlendMode:kCGBlendModeNormal alpha:1.0];
    }
}

The app draws well, but I've seen a dark outline while I'm drawing which disappear when touch ended.

While drawing

After drawing

Is there a way to avoid this outline when drawing?

Thanks.

Upvotes: 3

Views: 1446

Answers (1)

iphonic
iphonic

Reputation: 12719

The bezier path should be drawn in the end, in your case you are doing it in the beginning, [self.path stroke]; should be added in the end.

That should work.

Cheers.

Upvotes: 4

Related Questions