iOS development picture and color processing tool

Source: Internet
Author: User
1. Create a picture based on color
/** 根据颜色生成一张图片  @param color 颜色进制  UIColor类型 @return 一张UIImage图片 */+ (UIImage *)createImageWithColor:(UIColor *)color {    CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); //宽高 1.0只要有值就够了    UIGraphicsBeginImageContext(rect.size); //在这个范围内开启一段上下文    CGContextRef context = UIGraphicsGetCurrentContext();        CGContextSetFillColorWithColor(context, [color CGColor]);//在这段上下文中获取到颜色UIColor    CGContextFillRect(context, rect);//用这个颜色填充这个上下文        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();//从这段上下文中获取Image属性,,,结束    UIGraphicsEndImageContext();        return image;}

iOS development picture and color processing tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.