quartz2D 填充圆形
来源:互联网 发布:手机发布淘宝宝贝 编辑:程序博客网 时间:2024/04/30 00:55
- (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGRect mainSquare = self.bounds; CGContextSaveGState(context); // Create circle path and clip CGContextAddEllipseInRect(context, mainSquare); CGContextClip(context); // Define rects CGRect topLeft = CGRectMake(mainSquare.origin.x, mainSquare.origin.y, mainSquare.size.width / 2, mainSquare.size.height / 2); CGRect topRight = CGRectMake(mainSquare.size.width / 2, mainSquare.origin.y, mainSquare.size.width / 2, mainSquare.size.height / 2); CGRect bottomLeft = CGRectMake(mainSquare.origin.x, mainSquare.size.height / 2, mainSquare.size.width / 2, mainSquare.size.height / 2); CGRect bottomRight = CGRectMake(mainSquare.size.width / 2, mainSquare.size.height / 2, mainSquare.size.width / 2, mainSquare.size.height / 2); // Define colors CGColorRef topLeftColor = [[UIColor redColor] CGColor]; CGColorRef topRightColor = [[UIColor blueColor] CGColor]; CGColorRef bottomLeftColor = [[UIColor greenColor] CGColor]; CGColorRef bottomRightColor = [[UIColor yellowColor] CGColor]; // Fill rects with colors CGContextSetFillColorWithColor(context, topLeftColor); CGContextFillRect(context, topLeft); CGContextSetFillColorWithColor(context, topRightColor); CGContextFillRect(context, topRight); CGContextSetFillColorWithColor(context, bottomLeftColor); CGContextFillRect(context, bottomLeft); CGContextSetFillColorWithColor(context, bottomRightColor); CGContextFillRect(context, bottomRight); CGContextRestoreGState(context);}
- quartz2D 填充圆形
- Quartz2D裁剪圆形头像
- Quartz2D-圆形图片剪切
- Quartz2D裁剪圆形头像
- Quartz2D绘制圆形进度条
- Quartz2D 画图(圆形头像)
- Quartz2D绘图<四>图形填充
- Quartz2D-将图片裁剪为圆形
- Quartz2D——自定义圆形进度条
- Quartz2D - 图片裁剪为正圆形
- Quartz2D - 图片裁剪为圆形(加边框)
- Quartz2D笔记2-绘制直线,圆形,矩形
- iOS 之Quartz2D渐变颜色填充
- 圆形区域的半透明填充
- iOS Quartz2D - 裁剪图片为带边框的圆形图片
- Quartz2D——旋转、平移、缩放、剪切圆形图片
- Quartz2D - 图片裁剪为正圆形2(加边框)
- quartz2D 如何绘制圆形图片, 及圆环图片
- 活着
- f6
- Duilib下编辑框限定字符字数问题
- VSS无法获取所有子目录
- 数据库死锁的解决办法
- quartz2D 填充圆形
- C# winform 判断click事件点击的是左键还是右键
- 普林斯顿结构 VS 哈佛结构
- f8
- 犀利的系统验收工作
- javascript入门经典【推荐】—新手必备、零基础学习
- Servlet事件监听器(一)
- 防止ClistCtrl刷新闪烁的五种方法
- 如何正确使用SVN建立本地文件管理