我正在使用CLImageEditor作为绘图。需要从此图形中生成PNG作为输出。这很有效,但是当我缩放时边缘和文本不是那么平滑。无论如何我可以改进这个,我希望得到一个接近矢量图形的输出。这是代码块。
CGSize shadowOffset = self.shadowOffset;
UIColor *txtColor = self.textColor;
CGFloat outlineSize = self.outlineWidth * self.font.pointSize * 0.3;
CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(contextRef, outlineSize);
CGContextSetShouldSmoothFonts(contextRef, TRUE);
CGContextSetAllowsFontSmoothing(contextRef, TRUE);
CGContextSetLineJoin(contextRef, kCGLineJoinRound);
CGContextSetLineCap(contextRef, kCGLineCapRound);
CGContextSetShouldAntialias(contextRef, YES);
CGContextSetAllowsAntialiasing(contextRef, YES);
CGContextSetInterpolationQuality(contextRef, kCGInterpolationHigh);
CGContextSetTextDrawingMode(contextRef, kCGTextStroke);
self.textColor = self.outlineColor;
[super drawTextInRect:CGRectInset(rect, outlineSize/4, outlineSize/4)];
CGContextSetTextDrawingMode(contextRef, kCGTextFill);
self.textColor = txtColor;
[super drawTextInRect:CGRectInset(rect, outlineSize/4, outlineSize/4)];
self.shadowOffset = shadowOffset;