CGContextAddLines和CGContextAddLineToPoint在线条半透明时候的区别
来源:互联网 发布:淘宝自动发物流短信 编辑:程序博客网 时间:2024/05/16 04:53
这两种都可以用来画线,前一种将整条线加入后画出,后一种对每个点进行和前一个点的连线。
-(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);
}
而AddLineToPoint却会导致透明度重叠,且move touch的点出也会出现透明度重叠,会显示成点和点之间透明度正确,点上不透明的问题。
http://www.cnblogs.com/pengyingh/articles/2403225.html
- 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在模板使用的时候的区别
- I/O Redirection
- discuz二级、三级导航高亮,文章内容页跟随三级导航高亮的方法
- [Leetcode] Merge k Sorted Lists
- Eclipse中用Maven插件建立Web工程
- linux内存操作--ioremap和mmap学习笔记
- CGContextAddLines和CGContextAddLineToPoint在线条半透明时候的区别
- Linux内核源码树的建立
- C语言第四天
- wince下的编译选项
- 监控USB设备插拔
- tomcat指定特定的jdk
- 项目总结
- Genymotion 神器安装及问题处理,请我们都使用神器吧
- Oracle SCN时间机制