zoukankan      html  css  js  c++  java
  • iOS 图片加文字水印

    - (UIImage *) addText:(UIImage *)img text:(NSString *)mark {

        

        int w = img.size.width;

        int h = img.size.height;

        

        UIGraphicsBeginImageContext(img.size);

        

        [[UIColor redColor] set];

        [img drawInRect:CGRectMake(0, 0, w, h)];

        

        NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:20],

                              NSForegroundColorAttributeName:[UIColor redColor]};

        

        CGFloat pointX = w - 200;

        CGFloat pointY = h - 100;

        

        [mark drawInRect:CGRectMake(pointX  , pointY, 150, 100) withAttributes:dic];

        UIImage *aimg = UIGraphicsGetImageFromCurrentImageContext();

        UIGraphicsEndImageContext();

        return aimg;

    }

  • 相关阅读:
    了解JVM原理
    封装JS
    “==”和Equals的区别
    SpringMVC请求RequestMapping() 请求乱码
    博客25周
    博客24周
    博客23周
    博客22周
    博客第21周
    博客第21周
  • 原文地址:https://www.cnblogs.com/poky/p/5329039.html
Copyright © 2011-2022 走看看