iOS之UIBezierPath贝塞尔曲线属性简介
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <UIKit/UIKitDefines.h> NS_ASSUME_NONNULL_BEGIN typedef NS_OPTIONS(NSUInteger, UIRectCorner) {
UIRectCornerTopLeft = << ,
UIRectCornerTopRight = << ,
UIRectCornerBottomLeft = << ,
UIRectCornerBottomRight = << ,
UIRectCornerAllCorners = ~0UL
}; NS_CLASS_AVAILABLE_IOS(3_2) @interface UIBezierPath : NSObject<NSCopying, NSSecureCoding> //初始化
+ (instancetype)bezierPath; //初始化一个矩形路径
+ (instancetype)bezierPathWithRect:(CGRect)rect; //初始化一个椭圆路径,相切矩形的四条边。
+ (instancetype)bezierPathWithOvalInRect:(CGRect)rect; //初始化一个圆角矩形,矩形区域 边角半径
+ (instancetype)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius; /**
初始化圆角矩形 @param rect 矩形区域
@param corners 枚举:哪个角是圆角(多个时用 ‘|’分开)
@param cornerRadii 圆角半径
*/
+ (instancetype)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii; /**
初始化一个开放圆弧路径 @param center 圆心
@param radius 半径
@param startAngle 开始角度(0-M_PI)
@param endAngle 结束角度
@param clockwise 是否顺时针
*/
+ (instancetype)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise; //根据CGPath初始化对象
+ (instancetype)bezierPathWithCGPath:(CGPathRef)CGPath; - (instancetype)init NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; //设置路径,也可以获取一个不可变的路径!
@property(nonatomic) CGPathRef CGPath;
- (CGPathRef)CGPath NS_RETURNS_INNER_POINTER CF_RETURNS_NOT_RETAINED; //移动到当前点
- (void)moveToPoint:(CGPoint)point; //到当前点画一条直线
- (void)addLineToPoint:(CGPoint)point; /**
追加画一条三次贝塞尔曲线 @param endPoint 结束点
@param controlPoint1 控制点1
@param controlPoint2 控制点2
*/
- (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2; /**
追加画一条二次贝塞尔曲线 @param endPoint 结束点
@param controlPoint 控制点
*/
- (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint; /**
追加一条圆弧 @param center 中心点
@param radius 半径
@param startAngle 开始角度
@param endAngle 结束角度
@param clockwise 是否顺时针
*/
- (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise NS_AVAILABLE_IOS(4_0); //闭合路径
- (void)closePath; //去除所有路径
- (void)removeAllPoints; //追加bezierPath
- (void)appendPath:(UIBezierPath *)bezierPath; // 将原来的UIBezierPath反方向绘制(两个路径一样,方向不一样)
- (UIBezierPath *)bezierPathByReversingPath NS_AVAILABLE_IOS(6_0); // 进行放射,2D变换
- (void)applyTransform:(CGAffineTransform)transform; // Path info
@property(readonly,getter=isEmpty) BOOL empty; //路径是否为空
@property(nonatomic,readonly) CGRect bounds; //路径区域
@property(nonatomic,readonly) CGPoint currentPoint; //当前点
- (BOOL)containsPoint:(CGPoint)point; //是否包含某个点 // Drawing properties
@property(nonatomic) CGFloat lineWidth; //线宽
@property(nonatomic) CGLineCap lineCapStyle; //曲线终点样式 枚举
@property(nonatomic) CGLineJoin lineJoinStyle; //曲线连接处样式 枚举
@property(nonatomic) CGFloat miterLimit; // 连接处lineJoinStyle值是kCGLineJoinMiter,内角与外角距离,最大限制10
@property(nonatomic) CGFloat flatness; //渲染精度(默认0.6),数值越小,精度越高也越耗时!
@property(nonatomic) BOOL usesEvenOddFillRule; // 是否使用基偶填充规则,(默认是NO 非零规则) /**
绘制虚线路径 @param pattern C语言数组 CGFloat xx[] = {线段长度,间隙长度}; 轮流
@param count 数组个数
@param phase 从第几个数开始绘制
*/
- (void)setLineDash:(nullable const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase; /**
获取虚线样式 @param pattern 数组(空间必须大于路径空间)
@param count 数组个数
@param phase 开始位数
*/
- (void)getLineDash:(nullable CGFloat *)pattern count:(nullable NSInteger *)count phase:(nullable CGFloat *)phase; - (void)fill; //填充
- (void)stroke; //画线 /**
混合填充 @param blendMode 填充模式 枚举
@param alpha 透明度
*/
- (void)fillWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; /**
混合画线 @param blendMode 模式 枚举
@param alpha 透明度
*/
- (void)strokeWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; //剪切路径 之后路径只能在区域里画线
- (void)addClip; @end NS_ASSUME_NONNULL_END
iOS之UIBezierPath贝塞尔曲线属性简介的更多相关文章
- iOS - Quartz 2D 贝塞尔曲线
1.贝塞尔曲线 贝塞尔曲线(Bézier curve),又称贝兹曲线或贝济埃曲线,是应用于二维图形应用程序的数学曲线.一般的矢量图形软件通过它来精确画出曲线,贝兹曲线由线段与节点组成,节点是可拖动的支 ...
- 通过UIBezierPath贝塞尔曲线画圆形、椭圆、矩形
/**创建椭圆形的贝塞尔曲线*/ UIBezierPath *_ovalPath=[UIBezierPath bezierPathWithOvalInRect:CGRectMake(, , , )]; ...
- UIBezierPath 贝塞尔曲线
1. UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(30, 30, 100, 100) corner ...
- iOS贝塞尔曲线(UIBezierPath)的基本使用方法
简介 UIBezierPath是对Core Graphics框架的一个封装,使用UIBezierPath类我们可以画出圆形(弧线)或者多边形(比如:矩形)等形状,所以在画复杂图形的时候会经常用到. 分 ...
- 贝塞尔曲线(UIBezierPath)属性、方法汇总
UIBezierPath主要用来绘制矢量图形,它是基于Core Graphics对CGPathRef数据类型和path绘图属性的一个封装,所以是需要图形上下文的(CGContextRef),所以一般U ...
- iOS开发 贝塞尔曲线UIBezierPath
最近项目中需要用到用贝塞尔曲线去绘制路径 ,然后往路径里面填充图片,找到这篇文章挺好,记录下来 自己学习! 转至 http://blog.csdn.net/guo_hongjun1611/articl ...
- iOS开发 贝塞尔曲线UIBezierPath(2)
使用CAShapeLayer与UIBezierPath可以实现不在view的drawRect方法中就画出一些想要的图形 . 1:UIBezierPath: UIBezierPath是在 UIKit 中 ...
- iOS开发 贝塞尔曲线UIBezierPath(后记)
使用CAShapeLayer与UIBezierPath可以实现不在view的drawRect方法中就画出一些想要的图形 . 1:UIBezierPath: UIBezierPath是在 UIKit 中 ...
- UIBezierPath IOS贝塞尔曲线
//记录 贝塞尔曲线使用 //根据一个矩形画曲线 + (UIBezierPath *)bezierPathWithRect:(CGRect)rect //根据矩形框的内切圆画曲线 + (UIBezi ...
随机推荐
- IDEA与Tomcat的相关配置说明
1.IDEA会为每个Tomcat部署的项目单独建立一份配置文件 查看控制台的log输出:Using CATAINA_BASE 2.工作空间项目和Tomcat部署的web项目 WEB-INF:内的资源不 ...
- ASCII part of UTF8
UTF8 所以,本着节约的精神,又出现了把Unicode编码转化为“可变长编码”的UTF-8编码. UTF-8编码把一个Unicode字符根据不同的数字大小编码成1-6个字节,常用的英文字母被编码成1 ...
- HTML加载顺序
一.js执行顺序 //1. 外部引入的js文件,会异步下载并且执行(<script>块中的语句),根据引入的位置会在不同时刻执行 //2.$().ready(function() {}) ...
- 一张图轻松掌握 Flink on YARN 应用启动全流程(上)
Flink 支持 Standalone 独立部署和 YARN.Kubernetes.Mesos 等集群部署模式,其中 YARN 集群部署模式在国内的应用越来越广泛.Flink 社区将推出 Flink ...
- Spring+Mybatis常见问题随笔
错误1:无法绑定指定方法 异常堆栈:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 原因 ...
- LUOGU P3413 SAC#1 - 萌数(数位dp)
传送门 解题思路 首先这道题如果有两个以上长度的回文串,那么就一定有三个或两个的回文串,所以只需要记录一下上一位和上上位填的数字就行了.数位\(dp\),用记忆化搜索来实现.设\(f[i][j][k] ...
- SGI STL rope
rope实现的接口可以参考这里. rope是可伸缩的string实现: 它们被设计为用于把string看作一个整体的高效操作 . 比如赋值.串联和子串的操作所花的时间差不多不依赖字符串的长度.与C的字 ...
- jeecms jeecmsv93建库
create tablespace jeecms93 datafile 'jeecms93.dbf' size 100M reuse autoextend on next 50M;1. 2.drop ...
- collections,time,random,os, sys 模块的使用
主要内容:1. 模块的简单认识2. collections模块3. time时间模块4. random模块5. os模块6. sys模块 一. 模块的简单认识什么是模块. 模块就是我们把装有特定功能的 ...
- 《DSP using MATLAB》Problem 8.39
代码: %% ------------------------------------------------------------------------ %% Output Info about ...