zoukankan      html  css  js  c++  java
  • swift 在图片上根据点数组划线。

    func drawLineInImageWithImage(imageView:UIImageView,points:[CGPoint]){
            UIGraphicsBeginImageContext(imageView.frame.size);
            imageView.image?.drawInRect(CGRectMake(0, 0, imageView.frame.size.width, imageView.frame.size.height));
            CGContextSetLineCap(UIGraphicsGetCurrentContext(), CGLineCap.Round);
            CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
         CGContextSetAllowsAntialiasing(UIGraphicsGetCurrentContext(), true);
            CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), self.lineColor.r(),self.lineColor.g(),self.lineColor.b(),self.lineColor.a());
            CGContextBeginPath(UIGraphicsGetCurrentContext());
            let begin = points[0];
            CGContextMoveToPoint(UIGraphicsGetCurrentContext(), begin.x,begin.y);//起点坐标
            for point in points{
                CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), point.x, point.y);
            }
            //终点坐标
            CGContextStrokePath(UIGraphicsGetCurrentContext());
        imageView.image=UIGraphicsGetImageFromCurrentImageContext();
            UIGraphicsEndImageContext();
        }

  • 相关阅读:
    codevs1074 食物链
    Zjnu Stadium(加权并查集)
    加权并查集(银河英雄传说,Cube Stacking)
    Candies
    SPFA(热浪)
    trie树模板(统计难题)
    你有多久没有看过星星
    欧拉通路、回路
    exkmp
    Number Sequence (HDU 1711)
  • 原文地址:https://www.cnblogs.com/sunmair/p/6041480.html
Copyright © 2011-2022 走看看