By drawing a schematic line, programmatically

I would like to know if you guys have an idea of ​​how I could draw a sketchy line in an iOS app. I am currently drawing thanks to UIBezierPath, which I then process in a raster graphics context. How to make a string look sketchy?

// Produce and add points to draw in the UIBezierPath // Draw the path into the Bitmap context UIGraphicsBeginImageContext(self.bounds.size); [frameBuffer drawAtPoint:CGPointMake(0, 0) blendMode:kCGBlendModeCopy alpha:1.0]; [[datasource lineStrokeColorForSketchCanvas:self] setStroke]; [curvePath stroke]; image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); 

Thank you very well in advance :)

+4
source share
1 answer

I would suggest using a small batch of β€œsketchy” line textures, and then use these + UIBezierPath to place thumbnails along the path with the correct rotation.

You can draw them into context and save them so you don't have to generate them every time.

Development:

Start at one end of your UIBezierPath, each x points to a path, draw a sketchy section of the line centered at that point, continue driving until you reach the end of the path.

+1
source

All Articles