• ios 颜色转图片


     - (UIImage *)imageWithColor:(UIColor*) color
    {
        CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
        UIGraphicsBeginImageContext(rect.size);
        CGContextRef context = UIGraphicsGetCurrentContext();
        CGContextSetFillColorWithColor(context, [color CGColor]);
        CGContextFillRect(context, rect);
        UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return theImage;
    }
    - (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size
    {
        CGRect rect = CGRectMake(0, 0, size.width, size.height);
        UIGraphicsBeginImageContext(rect.size);
        CGContextRef context = UIGraphicsGetCurrentContext();
        CGContextSetFillColorWithColor(context,color.CGColor);
        CGContextFillRect(context, rect);
        UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        
        return img;
    }

  • 相关阅读:
    LOJ1036
    LOJ10132
    LOJ10131暗的连锁
    LOJ10128. 花神游历各国
    spoj 694(后缀数组)
    hdu 2459 (后缀数组+RMQ)
    hdu 3948(后缀数组+RMQ)
    ural 1297(后缀数组+RMQ)
    RMQ(dp)
    hdu 3518(后缀数组)
  • 原文地址:https://www.cnblogs.com/yujidewu/p/5290952.html
Copyright © 2020-2023  润新知