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));//在一个矩形里面内切一个椭圆其实是比较简单的
  • 相关阅读:
    CentOS7 配置登录前显示IP
    用indexOf方法实现 数组去重
    easyui datagrid checkbox 禁止点击方法
    EasyUI常用图标
    Markdown基本语法
    百度地图标记
    Activity中的单击事件-------使用匿名内部类实现简单的跳转效果
    java.lang.ClassFormatError: Extra bytes at the end of class file quartz/loader/MyCalcSalary
    java.net.MalformedURLException: no !/ in spec
    Oracle 常见函数
  • 原文地址:https://www.cnblogs.com/liyang31tg/p/4114981.html
Copyright © 2011-2022 走看看