zoukankan      html  css  js  c++  java
  • 通过UIBezierPath贝塞尔曲线画圆形、椭圆、矩形

    /**创建椭圆形的贝塞尔曲线*/
        UIBezierPath *_ovalPath=[UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 200, 100)];
        
        /**创建矩形的贝塞尔曲线*/
        UIBezierPath *_rectPath=[UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 200, 100)];
        
        
        /**创建圆形的贝塞尔曲线*/
        
        UIBezierPath *_circlePath=[UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 100, 100)];
        UIBezierPath *_shapePath=[UIBezierPath bezierPathWithArcCenter:CGPointMake(20, 0) radius:100 startAngle:0 endAngle:3.14*2 clockwise:YES];
    
        /**创建带形状的图层*/
        CAShapeLayer *_shapeLayer=[CAShapeLayer layer];
        _shapeLayer.frame=CGRectMake(0, 0, 200, 100);
        _shapeLayer.position=self.view.center;
        
        /**注意:图层之间与贝塞尔曲线之间通过path进行关联*/
        _shapeLayer.path=_shapePath.CGPath;
        
        _shapeLayer.fillColor=[UIColor redColor].CGColor;
        [self.view.layer addSublayer:_shapeLayer];
  • 相关阅读:
    ps:图层知识
    ps:选区的存储及载入
    ps:消除锯齿和羽化
    ps:不规则选区
    ps:建立规则选区
    python如何查看内存占用空间
    python-生成器
    python3-列表生成式
    python:迭代
    Photoshop画笔工具的使用
  • 原文地址:https://www.cnblogs.com/thbbsky/p/4383745.html
Copyright © 2011-2022 走看看