I draw several CGPaths in a Cocoa view in the drawRect method on an iPad. I started drawing them right in the context of UIGraphicsGetCurrentContext() , but the performance went south when my paths became very long. Based on a few other questions, I began to study using CGLayer s.
So, now I have to make the path inside the CGContextRef that I get from the call to CGLayerGetContext . Here is a basic outline of what I'm doing:
Now I get a good performance drawing, but my lines are very jagged and seem to be not smooth. I tried adding
CGContextSetShouldAntialias(layerContext, YES); CGContextSetAllowsAntialiasing(layerContext, YES); CGContextSetInterpolationQuality(layerContext, kCGInterpolationHigh);
to the above code to no avail. I even set the smoothing properties on the main context unchanged. I took screenshots with the same code results, but with the second image there was an image created from a drawing in CGLayer . As you can see, it is really jagged, despite the fact that it is the same code, just by painting in layerContext . How can I make strings in CGLayer smooth?


iphone cocoa ipad quartz-graphics quartz-2d
Streeter Aug 6 2018-11-11T00: 00Z
source share