贝塞尔曲线
来源:互联网 发布:java中如何导人gson 编辑:程序博客网 时间:2024/04/29 15:05
-(void)drawRect:(CGRect)rect
{
// [self drawTrianglePath];
// [self drawRectPath];
// [self drawCircle];
[selfdrawCorner];
// [self drawRadian];
// [self drawSecondBezierPath];
// [self drawThirdBezierPath];
}
-(void)drawTrianglePath
{
UIBezierPath *payh = [UIBezierPathbezierPath];
[payh moveToPoint:CGPointMake(10,20)];
[payh addLineToPoint:CGPointMake(300,20)];
[payh addLineToPoint:CGPointMake(150,150)];
[payhclosePath];
//设置线条宽度
payh.lineWidth =2.0;
//填充色必须设置在画笔颜色前边
//设置填充颜色
UIColor *color = [UIColorgreenColor];
[colorset];
[payhfill];
//设置画笔颜色
UIColor *strokeColor = [UIColorblueColor];
[strokeColorset];
[payhstroke];
}
//正方形
-(void)drawRectPath
{
UIBezierPath *path = [UIBezierPathbezierPathWithRect:CGRectMake(10,150, 100, 100)];
path.lineWidth =1.5;
path.lineCapStyle =kCGLineCapRound;
path.lineJoinStyle =kCGLineJoinBevel;
UIColor *color = [UIColorredColor];
[colorset];
[pathfill];
UIColor *strokeColor = [UIColorblueColor];
[strokeColorset];
[pathstroke];
}
//画圆(椭圆)
-(void)drawCircle
{
UIBezierPath *path = [UIBezierPathbezierPathWithOvalInRect:CGRectMake(10,10, 120, 200)];
path.lineWidth =2.0;
UIColor *color = [UIColorblueColor];
[colorset];
[pathfill];
[pathclosePath];
}
//圆角
-(void)drawCorner
{
//矩形的某个角是圆角 CGSizeMake用来指定水平和垂直方向的半径大小
UIBezierPath *path = [UIBezierPathbezierPathWithRoundedRect:CGRectMake(10,20, 100, 100)byRoundingCorners:UIRectCornerTopLeftcornerRadii:CGSizeMake(100,20)];
//矩形四个角都为圆角
UIBezierPath *path1 = [UIBezierPathbezierPathWithRoundedRect:CGRectMake(10,10, 150, 150)cornerRadius:10];
path.lineWidth =1.5;
UIColor *color = [UIColorredColor];
[colorset];
[pathstroke];
[pathclosePath];
}
//画弧
-(void)drawRadian
{
//startAngle(开始的角度)endAngle(结束的角度) clockwise(是否顺时针画弧);
float PI = 3.1415926;
UIBezierPath *path = [UIBezierPathbezierPathWithArcCenter:CGPointMake(150,100) radius:100startAngle:(PI*22)/180endAngle:(PI*180)/180clockwise:NO];
path.lineWidth =1.5;
UIColor *color = [UIColorredColor];
[colorset];
[pathstroke];
[pathclosePath];
}
//二次贝塞尔曲线(起点+控制点(控制点起牵引作用未必一定要经过)+结束点)
-(void)drawSecondBezierPath
{
UIBezierPath *path = [UIBezierPathbezierPath];
//首先设置起始点
[path moveToPoint:CGPointMake(10,10)];
//添加曲线
[path addQuadCurveToPoint:CGPointMake(220,150) controlPoint:CGPointMake(150,10)];
path.lineWidth =1.5;
UIColor *color = [UIColorredColor];
[colorset];
[pathstroke];
[pathclosePath];
}
//三次贝塞尔曲线(道理同上只是多了一个控制点)
-(void)drawThirdBezierPath
{
UIBezierPath *path = [UIBezierPathbezierPath];
[path moveToPoint:CGPointMake(10,150)];
[path addCurveToPoint:CGPointMake(320,150) controlPoint1:CGPointMake(150,20) controlPoint2:CGPointMake(220,230)];
path.lineWidth =1.5;
UIColor *color = [UIColorredColor];
[colorset];
[pathstroke];
[pathclosePath];
}
- 曲线平滑-贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 贝塞尔曲线
- 应用VMWare配置CentOS虚拟机IP地址
- vs-mda-remote cordova真机测试ios
- KMP算法——South Central USA 2006 蓝色牛仔裤
- 如何判断用户输入的是否为合理手机号
- 一些分享,coding的,songtaste的!
- 贝塞尔曲线
- linux中memset的正确用法
- Okhttp封装、网络层扩展
- START WITH--CONNECT BY PRIO
- 引入tomcat library却没有部署到tomcat上报错
- PAT (Advanced Level) Practise 1102 Invert a Binary Tree (25)
- android给Listview或GridView的item设定高度(可能是最好的解决方案)
- MySQL数据记录基本操作——多表查询、子查询和正则表达式查询
- Case when