zoukankan      html  css  js  c++  java
  • ios 绘制线条

    //添加被塞尔曲线 
       CGContextMoveToPoint(cgContext, 150, 100); //移动到某一个点           
       CGContextAddCurveToPoint(cgContext, 150, 100, 100, 100, 100, 150);//绘制被塞尔曲线,点伴随移动,这三个参数呢,每2个为一个参数
        1.point(150100)表示开始点
        2.point(100100)表示为控制点
        3.point(100150)表示为终止点
       //综上:就是绘制一条曲线的切线相交处为控制点
        CGContextAddCurveToPoint(cgContext, 100, 150, 100, 200, 150, 200);//
        CGContextAddCurveToPoint(cgContext, 150, 200, 200, 200, 200, 150);//
        CGContextAddCurveToPoint(cgContext, 200, 150, 200, 100, 150, 100);//
        [[UIColor redColor] setFill];//填充颜色
        CGContextDrawPath(cgContext, kCGPathStroke);//画笔画上
       //  CGContextAddLineToPoint(cgContext, 50, 50);
    CGContextAddLineToPoint(cgContext, 200, 30);//添加一条直线
    //添加一个矩形
    CGContextAddRect(cgContext, CGRectMake(100, 100, 100, 100));
    //添加弧度
    CGContextAddArc(cgContext, 100, 100, 50,  3.14/ 2, 270* 3.14/ 180, 1);
    //1.原点(100,100)
    //2.半径 50
    //3.开始弧度 3.14/ 2 ,3.14就是圆周率
    //4.结束弧度270* 3.14/ 180
    //5.逆时针为1,0为顺时针
    //---------- 解释一下圆的弧度,弧度是按照顺时针来计算弧度的,那么开始弧度和结束弧度就确定了,弧度确定了那么按照顺逆时针来画就比较简单了
    CGContextClosePath(cgContext);//封闭曲线
    CGContextAddEllipseInRect(cgContext, CGRectMake(100, 100, 200, 100));//在一个矩形里面内切一个椭圆其实是比较简单的
  • 相关阅读:
    弹出框位置设置
    Spring Boot 发布 jar 包转为 war 包秘籍
    Oracle 动态sql小例子
    [转]ORACLE EXECUTE IMMEDIATE 小结
    [转]Java web 开发 获取用户ip
    SQLServer2008 使用sql语句访问excel数据
    Oracle 循环调用存储过程
    JavaScript 判断手机端操作系统(Andorid/IOS)
    Oracle 当输入参数允许为空时
    Oracle 生成数据字典
  • 原文地址:https://www.cnblogs.com/liyang31tg/p/4114981.html
Copyright © 2011-2022 走看看