美文网首页
图形上下文

图形上下文

作者: KeepFighting | 来源:发表于2016-02-09 13:53 被阅读80次

    1. 开启图形上下文,指定尺寸,不透明,缩放参数为0,即根据当前屏幕自动缩放 UIGraphicsBeginImageContextWithOptions(image.size,NO,0);

    2.描述裁剪路径

    UIBezierPath*path = [UIBezierPathbezierPathWithOvalInRect:CGRectMake(0,0, image.size.width, image.size.height)];

    3.设置裁剪区域

    [path addClip];

    4.绘图

    [imagedrawAtPoint:CGPointZero];

    5.获取绘制后的图片内容

    image =UIGraphicsGetImageFromCurrentImageContext();

    5.关闭上下文

    UIGraphicsEndImageContext();

    相关文章

      网友评论

          本文标题:图形上下文

          本文链接:https://www.haomeiwen.com/subject/gtwykttx.html