成都创新互联网站制作重庆分公司

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图像处理之画圆角矩形
网站网址:http://cxhlcq.com/article/pipgie.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部