• iOS Quartz2D图形上下文栈


        // 获取图形上下文

        CGContextRef ctx = UIGraphicsGetCurrentContext();

        // 存储上下文栈

        CGContextSaveGState(ctx);

        // 设置图形上下文

        CGContextSetLineWidth( ctx, 10);

        [[UIColor redColor] set];

        

        // 画第1根线

        CGContextMoveToPoint(ctx, 50, 50);

        CGContextAddLineToPoint(ctx, 200, 190);

        CGContextStrokePath(ctx);

        

        // 图形上下文栈的栈顶上下文出栈,替换当前上下文

        CGContextRestoreGState(ctx);

        

        // 画第2根线

        CGContextMoveToPoint(ctx, 10, 200);

        CGContextAddLineToPoint(ctx, 300, 50);

        CGContextStrokePath(ctx);

  • 相关阅读:
    053-606
    053-605
    1019 General Palindromic Number (20分)
    1208. 翻硬币
    754. 平方矩阵 II
    1346. 回文平方
    680. 剪绳子
    1227. 分巧克力
    756. 蛇形矩阵
    429. 奖学金
  • 原文地址:https://www.cnblogs.com/oumygade/p/4359749.html
Copyright © 2020-2023  润新知