iOS图像处理之画圆角矩形
CGContextRef ctx = UIGraphicsGetCurrentContext();
????CGContextSaveGState(ctx);
????
????//畫圓矩形
????
????//設(shè)置線寬
????CGContextSetLineWidth(ctx, BORDE_WIDTH);
????
????//設(shè)置填充顏色和畫筆顏色
????CGContextSetFillColorWithColor(ctx, self.color.CGColor);
????CGContextSetStrokeColorWithColor(ctx, [UIColor yellowColor].CGColor);
????
????
????CGPathRef clippath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake([self offsets].width,[self offsets].height, [self size].width, [self size].height) cornerRadius:CR_RADIUS].CGPath;
????CGContextAddPath(ctx, clippath);
// ???//找到各個角點
// ???CGPoint p_0_0 = CGPointMake([self offsets].width, [self offsets].height);
// ???CGPoint p_0_1 = CGPointMake([self offsets].width + [self size].width, [self offsets].height);
// ???CGPoint p_1_0 = CGPointMake([self offsets].width, [self offsets].height + [self size].height);
// ???CGPoint p_1_1 = CGPointMake([self offsets].width + [self size].width, [self offsets].height + [self size].height);
// ???CGContextMoveToPoint(ctx, p_1_0.x , p_1_0.y - CR_RADIUS * 2);
// ???CGContextAddArcToPoint(ctx, p_0_0.x, p_0_0.y, p_0_0.x + CR_RADIUS*2, p_0_0.y, CR_RADIUS);
// ???CGContextAddArcToPoint(ctx, p_0_1.x, p_0_1.y, p_0_1.x, p_0_1.y ?+ CR_RADIUS*2, CR_RADIUS);
// ???CGContextAddArcToPoint(ctx, p_1_1.x, p_1_1.y, p_1_1.x - CR_RADIUS*2, p_1_1.y, CR_RADIUS);
// ???CGContextAddArcToPoint(ctx, p_1_0.x, p_1_0.y, p_1_0.x, p_1_0.y - CR_RADIUS*2, CR_RADIUS);
???
????CGContextClosePath(ctx);
????CGContextDrawPath(ctx, kCGPathFillStroke);
本文轉(zhuǎn)自 卓行天下? 51CTO博客,原文鏈接:http://blog.51cto.com/9951038/1772555,如需轉(zhuǎn)載請自行聯(lián)系原作者
總結(jié)
以上是生活随笔為你收集整理的iOS图像处理之画圆角矩形的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Html 让文字显示在图片的上面
- 下一篇: 质量frr_【转】 FAR FRR EE