2016-03-03 65 views
2

如何繪製造型線?例如心臟,鑽石或星形線與CGContextRefiOS - 如何用CGContextRef繪製造型線

心行示例:

enter image description here

鑽石行示例:

enter image description here

三角行示例:

enter image description here

小號焦油行示例:

enter image description here

這是我目前有:

- (void)draw 
{ 
    CGContextRef context = UIGraphicsGetCurrentContext(); 
    CGContextAddPath(context, path); 
    CGContextSetLineCap(context, kCGLineCapRound); 
    CGContextSetLineWidth(context, self.lineWidth); 
    CGContextSetStrokeColorWithColor(context, self.lineColor.CGColor); 
    CGContextSetBlendMode(context, kCGBlendModeNormal); 
    CGContextSetAlpha(context, self.lineAlpha); 
    CGContextStrokePath(context); 
} 

上面的代碼僅消耗普通的筆線。

我可以使用Photoshop製作的.png圖像來繪製造型線嗎?請指導我如何做到這一點。

回答