绘制图像

时间:2018-04-05 14:36:07

标签: android

我想知道如何在android上绘制图像。 我目前正在使用Swift这样做:

func rectangularCurvePath() { 
    var rectangleWithCurves: UIBezierPath!
    rectangleWithCurves = UIBezierPath()
    rectangleWithCurves.move(to: CGPoint(x: 0.0, y: 30))
    rectangleWithCurves.addArc(withCenter: CGPoint(x: 30, y: 30), radius: 30, startAngle: CGFloat(180.0).toRadians(), endAngle: CGFloat(270.0).toRadians(), clockwise: true)
    rectangleWithCurves.addLine(to: CGPoint(x: self.frame.size.width-30, y:0.0 ))
    rectangleWithCurves.addArc(withCenter: CGPoint(x: self.frame.size.width-35, y: 35), radius: 35, startAngle: CGFloat(270.0).toRadians(), endAngle: CGFloat(0.0).toRadians(), clockwise: true)
    rectangleWithCurves.addLine(to: CGPoint(x: self.frame.size.width, y:30))
    rectangleWithCurves.addArc(withCenter: CGPoint(x: self.frame.size.width-35, y: self.frame.size.height-35), radius: 35, startAngle: CGFloat(0.0).toRadians(), endAngle: CGFloat(100.0).toRadians(), clockwise: true)
    rectangleWithCurves.addLine(to: CGPoint(x: 30, y: self.frame.size.height/1.2))
    rectangleWithCurves.addArc(withCenter: CGPoint(x: 30, y: (self.frame.size.height/1.2)-30), radius: 30, startAngle: CGFloat(135.0).toRadians(), endAngle: CGFloat(180.0).toRadians(), clockwise: true)
    rectangleWithCurves.close()

}

我正在尝试绘制以下图片。enter image description here

0 个答案:

没有答案