I want to draw a line like chalk. And the edge of the line is weak. Just like using chalk, draw on the blackboard.
How do i get this? Now I drew a line using the image, but on the board it does not look like drawing, because the line is not weak. Please give me some advice.
Here is my code:
for (NSDictionary *dictStroke in self.arrayStrokes)
{
NSArray *arrayPointsInstroke = [dictStroke objectForKey:@"points"];
UIColor *color = [UIColor colorWithPatternImage:[UIImage imageNamed:@"point.png"]];
float size = [[dictStroke objectForKey:@"size"] floatValue];
[color setStroke];
UIBezierPath* pathLines = [UIBezierPath bezierPath];
CGPoint pointStart = CGPointFromString([arrayPointsInstroke objectAtIndex:0]);
[pathLines moveToPoint:pointStart];
for (int i = 0; i < (arrayPointsInstroke.count - 1); i++)
{
CGPoint pointNext = CGPointFromString([arrayPointsInstroke objectAtIndex:i+1]);
[pathLines addLineToPoint:pointNext];
}
pathLines.lineWidth = size;
pathLines.lineJoinStyle = kCGLineJoinRound;
pathLines.lineCapStyle = kCGLineCapRound;
[pathLines stroke];
arraynum++;
}
source
share