iOS图像处理之画圆角矩形

CGContextRef ctx = UIGraphicsGetCurrentContext();

作为一家“创意+整合+营销”的成都网站建设机构,我们在业内良好的客户口碑。创新互联公司提供从前期的网站品牌分析策划、网站设计、成都网站建设、网站制作、创意表现、网页制作、系统开发以及后续网站营销运营等一系列服务,帮助企业打造创新的互联网品牌经营模式与有效的网络营销方法,创造更大的价值。

    CGContextSaveGState(ctx);

    

    //画圆矩形

    

    //设置线宽

    CGContextSetLineWidth(ctx, BORDE_WIDTH);

    

    //设置填充颜色和画笔颜色

    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);

本文题目:iOS图像处理之画圆角矩形
文章地址:https://www.cdcxhl.com/article4/pipgie.html

成都网站建设公司_创新互联,为您提供响应式网站品牌网站建设电子商务网页设计公司建站公司域名注册

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

营销型网站建设