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 ...
随机推荐
- 2-MySQL高级-事务-基本概念(1)
事务 1. 为什么要有事务 事务广泛的运用于订单系统.银行系统等多种场景 例如: A用户和B用户是银行的储户,现在A要给B转账500元,那么需要做以下几件事: 检查A的账户余额>500元: A ...
- 【POJ】1251 Jungle Roads
题目链接:http://poj.org/problem?id=1251 题意:n个村庄字母标号,每个字母后跟m个字母,表示该字母到mi的距离.求构建所有村庄道路的最短距离. 题解:最小生成树裸题.注意 ...
- Nginx+win10安装配置
一.前言 Nginx是一款自由的.开源的.高性能的HTTP服务器和反向代理服务器,同时也提供了IMAP/POP3/SMTP服务.Nginx可以进行反向代理.负载均衡.HTTP服务器(动静分离).正向代 ...
- Windows服务调试状态下用Console启动
最近一直在用服务,发现服务也没有那么难调试. Windows服务调试状态下用Console启动:步骤分两步 第一步改Program,启动代码 static class Program { /// &l ...
- bcolz
raise Exception("this is an ex") bcolz总结: 0.需要用bcolz的columns需要为ndarray的列,不能直接拿list去赋值,因为我发 ...
- bzoj1568 Blue Mary
题意:P:加入一条一次函数.Q:询问x位置的最大函数值. 标程: #include<bits/stdc++.h> using namespace std; ; int q,x,n; dou ...
- CodeForces - 803F
http://codeforces.com/problemset/problem/803/F #include <iostream> #include <cstdio> #in ...
- a^a^a^a^a^a^a^a^a
a^a^a^a是从前向后算,也就是a^(a^3)
- Windows 开启win32 控制台
{ AllocConsole(); FILE *Journal = NULL; freopen_s(&Journal, "CONOUT$", &qu ...
- CNN 常用的几个模型
LeNet5 论文:http://yann.lecun.com/exdb/publis/pdf/lecun-01a.pdf LeNet-5:是Yann LeCun在1998年设计的用于手写数字识别的卷 ...