zoukankan      html  css  js  c++  java
  • 图片变灰

    /**
     图片变灰
     */
    -(UIImage*)getGrayImage:(UIImage*)sourceImage
    {
        int width = sourceImage.size.width;
        int height = sourceImage.size.height;
        
        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
        CGContextRef context = CGBitmapContextCreate (nil,width,height,8,0,colorSpace,kCGImageAlphaNone);
        CGColorSpaceRelease(colorSpace);
        
        if (context == NULL) {
            return nil;
        }
        
        CGContextDrawImage(context,CGRectMake(0, 0, width, height), sourceImage.CGImage);
        UIImage *grayImage = [UIImage imageWithCGImage:CGBitmapContextCreateImage(context)];
        CGContextRelease(context);
        
        return grayImage;
    }
    
  • 相关阅读:
    软硬链接
    查看文件内容
    cp+mv
    cd+rm+pwd
    ls+tree
    绝对路径和相对路径
    Linux目录结构
    修改hostname
    java. util. concurrent. atomic
    git
  • 原文地址:https://www.cnblogs.com/ritian/p/5949853.html
Copyright © 2011-2022 走看看