zoukankan      html  css  js  c++  java
  • iOS 防止离屏渲染为 image 添加圆角

     
     

    // image 分类

    - (UIImage *)circleImage{

        // NO 代表透明

        UIGraphicsBeginImageContextWithOptions(self.size, NO, 1);

        // 获得上下文

        CGContextRef ctx = UIGraphicsGetCurrentContext();

        // 添加一个圆

        CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height);

        // 方形变圆形

        CGContextAddEllipseInRect(ctx, rect);

        // 裁剪

        CGContextClip(ctx);

        // 将图片画上去

        [self drawInRect:rect];

        UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();

        return image;

    }


     

  • 相关阅读:
    windows防火墙失效
    unity_animator_stop_replay(重新播放)
    使用rider做为unity的代码编辑器
    分母为0的坑(float)
    动画或特效不会播放(被裁剪)
    UGUI在两个UI间坐标转换
    informix 查看 当前锁表
    java protected 与默认权限的区别
    Java 定时任务
    在线支付
  • 原文地址:https://www.cnblogs.com/jukaiit/p/9675305.html
Copyright © 2011-2022 走看看