CGContextAddLines和CGContextAddLineToPoint在线条半透明时候的区别
来源:互联网 发布:js style属性值 编辑:程序博客网 时间:2024/05/16 10:44
这两种都可以用来画线,前一种将整条线加入后画出,后一种对每个点进行和前一个点的连线。
-(void)drawLine:(YJLines *)line{
int count = [line.points count];
CGPoint addLines[count];
for (int j=0; j< [line.points count]; j++)
{
CGPoint point = CGPointFromString((NSString *)[line.points objectAtIndex:j]);
addLines[j].x = point.x;
addLines[j].y = point.y;
}
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineJoin(context, kCGLineJoinRound);
CGContextSetLineCap(context , kCGLineCapRound);
CGContextSetBlendMode(context, kCGBlendModeNormal);
CGContextBeginPath(context);
CGContextAddLines(context, addLines, count);
CGContextSetLineWidth(context, line.lineWidth);
CGContextSetAlpha(context, line.lineAlpha);
CGContextSetStrokeColorWithColor(context, line.lineColor.CGColor);
CGContextStrokePath(context);
}
- (void) contextDrawFrom: (CGPoint)last toPoint:(CGPoint)current withLine:(YJLines *)ln {
CGContextRef context = UIGraphicsGetCurrentContext();
// CGContextSetMiterLimit(context, 0.5);
CGContextSetLineJoin(context, kCGLineJoinRound);
CGContextSetLineCap(context , kCGLineCapRound);
CGContextSetBlendMode(context, kCGBlendModeNormal);
CGContextBeginPath(context);
CGContextMoveToPoint(context, last.x, last.y);
CGContextAddLineToPoint(context, current.x, current.y);
CGContextSetLineWidth(context, ln.lineWidth);
CGContextSetAlpha(context, ln.lineAlpha);
CGContextSetStrokeColorWithColor(context, ln.lineColor.CGColor);
CGContextStrokePath(context);
}
- CGContextAddLines和CGContextAddLineToPoint在线条半透明时候的区别
- CGContextAddLines和CGContextAddLineToPoint在线条半透明时候的区别
- iOS绘图系列二:画直线 CGContextMoveToPoint,CGContextAddLineToPoint,CGContextAddLines,
- iOS: CGContext的函数CGContextAddLines
- iOS: CGContext的函数CGContextAddLineToPoint
- 半透明状态栏与导航条的错位
- Android之Translucent Bar半透明栏和immersive bar沉浸式的区别
- iPhone半透明状态栏与导航条错位的解决办法
- iPhone半透明状态栏与导航条错位的解决办法
- iPhone半透明状态栏与导航条错位的解决办法
- iPhone半透明状态栏与导航条错位的解决办法
- wheelbarrow.c和半透明窗体相关的
- firefox和IE都支持的半透明
- View和其subview的半透明问题
- で和に在表示地点的时候的区别
- 数组和指针在编译的时候的区别
- 【转】数组和指针在编译的时候的区别
- typename 和 class在模板使用的时候的区别
- 第十三周项目1数组大折腾(1)
- 分享js
- Neighboring Subsystem
- 判断一个数是不是2的幂
- [Swift]属性和下标
- CGContextAddLines和CGContextAddLineToPoint在线条半透明时候的区别
- cocos2dx3.2 某些UI白屏或使用ClippingNode造成部分手机白屏
- C#箴言:定义常量的两种方法
- “钢铁侠”马斯克为何屡次抨击人工智能,是炒作还是内藏玄机?
- 十三周项目一
- 文本框的渐显
- 3D游戏制作
- 初识SQL数据库之2
- Qt中qDebug 的使用