zoukankan      html  css  js  c++  java
  • CGContext画图几个环境配置方法总结

    1、CGContextRef context = UIGraphicsGetCurrentContext(); 设置上下文

    CGContextMoveToPoint 开始画线
     CGContextAddLineToPoint 画直线

     CGContextAddEllipseInRect 画一椭圆
     CGContextSetLineCap 设置线条终点形状
     CGContextSetLineDash 画虚线
     CGContextAddRect 画一方框
     CGContextStrokeRect 指定矩形
     CGContextStrokeRectWithWidth 指定矩形线宽度
     CGContextStrokeLineSegments 一些直线

    2、环境配置:

    CGContextBeginPath(ctx);/* Begin a new path. The old path is discarded. */ 开始配置一条新的路径

    CGContextMoveToPoint(CGContextRef cg_nullable c,CGFloat x, CGFloat y) /* Start a new subpath at point `(x, y)' in the context's path. */  在layer上添加一个新的子路径,设置起点(x,y)。

    CGContextAddLineToPoint(CGContextRef cg_nullable c, CGFloat x, CGFloat y)/* Append a straight line segment from the current point to `(x, y)'. */*从当前点追加一条直线段到(x,y)。* /

    CGContextStrokePath(CGContextRef cg_nullable c)/* Stroke the context's path. */* 设置上下文路径。画线* /

    UIGraphicsPushContext(ctx);环境配置压栈,保存

    UIGraphicsPopContext();回复环境配置

  • 相关阅读:
    rmq +二分暴力 hdu 5726
    8.25 ccpc 比赛总结
    莫比乌斯反演题目总结
    HDU 4848 Wow! Such Conquering! (搜索+floyd)
    Codeforces 982 C Cut 'em all!(DFS)
    Codefoces 986C AND Graph(DFS)
    CodeForces 986A Fair(BFS)
    ACM经验贴
    Kattis A+B Problem(FFT)
    CF E. Porcelain (双向dp)
  • 原文地址:https://www.cnblogs.com/xin-lang/p/6762110.html
Copyright © 2011-2022 走看看