zoukankan      html  css  js  c++  java
  • 利用Quartz2D-contex绘制文本

    //获取上下文
      CGContextRef context =UIGraphicsGetCurrentContext();
        //线条加粗
        CGContextSetLineWidth(context , 5);
     
    CGContextSetLineWidth(context, 5);
        CGRect rect =CGContextGetClipBoundingBox(context);
        //填充颜色
        CGContextSetFillColorWithColor(context, [[UIColor whiteColor]CGColor]);
        CGContextFillRect(context, rect);
        CGContextSetAllowsAntialiasing(context, YES);
        //填充颜色
        CGContextSetFillColorWithColor(context, [[UIColor brownColor]CGColor]);
        NSString *str =@"小黑是小狗";
        [str drawInRect:CGRectMake(100, 100, 100, 100) withFont:[UIFont systemFontOfSize:30.0]];

        CGContextSetTextMatrix(context, CGAffineTransformScale(CGAffineTransformIdentity, 1, -1));
        //填充颜色
        CGContextSetStrokeColorWithColor(context, [[UIColor whiteColor]CGColor]);
        CGContextStrokeRect(context, CGRectMake(100, 100, 100, 100));
            CGContextStrokeRect(context, CGRectMake(100, 100, 100, 100));
        CGContextStrokePath(context);
       
  • 相关阅读:
    java获取年份的后两位
    jdbcTemplate的Dao层封装
    beta准备
    福大软工 · 第十一次作业
    Alpha 冲刺 (10/10)
    Alpha 冲刺 (9/10)
    Alpha 冲刺 (8/10)
    Alpha 冲刺 (7/10)
    Alpha 冲刺 (6/10)
    Alpha 冲刺 (5/10)
  • 原文地址:https://www.cnblogs.com/yxt9322yxt/p/4768329.html
Copyright © 2011-2022 走看看