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));//在一个矩形里面内切一个椭圆其实是比较简单的
  • 相关阅读:
    给元素查索引
    数组的反转和排序
    本地修改文件到git
    +new Date()
    文字双层投影
    表格组件 自定义宽度 设置 span 内容 超出省略号
    iframe的使用
    分页获取列表进行索引累加
    日期时间格式化
    柱状echarts 自定义图例设置
  • 原文地址:https://www.cnblogs.com/liyang31tg/p/4114981.html
Copyright © 2011-2022 走看看