Last active
April 15, 2020 16:27
-
-
Save EnesKaraosman/151c898ac2c8b857608fa799649e5b8a to your computer and use it in GitHub Desktop.
Path methods.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Okunabilirliği arttırmak amaçlı, düzenleme yaptım. | |
extension Path { | |
/// Begins a new subpath at the specified point. | |
func move(to p: CGPoint) | |
/// Appends a straight line segment from the current point to the | |
/// specified point. | |
func addLine(to p: CGPoint) | |
/// Adds a quadratic Bézier curve to the path, with the | |
/// specified end point and control point. | |
func addQuadCurve(to p: CGPoint, control cp: CGPoint) | |
/// Adds a cubic Bézier curve to the path, with the | |
/// specified end point and control points. | |
func addCurve( | |
to p: CGPoint, | |
control1 cp1: CGPoint, | |
control2 cp2: CGPoint | |
) | |
/// Closes and completes the current subpath. | |
func closeSubpath() | |
/// Adds a rectangular subpath to the path. | |
func addRect( | |
_ rect: CGRect, | |
transform: CGAffineTransform = .identity | |
) | |
/// Adds a rounded rectangle to the path. | |
func addRoundedRect( | |
in rect: CGRect, | |
cornerSize: CGSize, | |
style: RoundedCornerStyle = .circular, | |
transform: CGAffineTransform = .identity | |
) | |
/// Adds an ellipse to the path. | |
func addEllipse( | |
in rect: CGRect, | |
transform: CGAffineTransform = .identity | |
) | |
/// Adds an arc of a circle to the path, specified with a radius | |
/// and a difference in angle. | |
func addRelativeArc( | |
center: CGPoint, | |
radius: CGFloat, | |
startAngle: Angle, | |
delta: Angle, | |
transform: CGAffineTransform = .identity | |
) | |
/// Adds an arc of a circle to the path, specified with a radius | |
/// and angles. | |
func addArc( | |
center: CGPoint, | |
radius: CGFloat, | |
startAngle: Angle, | |
endAngle: Angle, | |
clockwise: Bool, | |
transform: CGAffineTransform = .identity | |
) | |
/// Appends a copy of `path` to the path. | |
func addPath( | |
_ path: Path, | |
transform: CGAffineTransform = .identity | |
) | |
/// Returns the last point in the path, or nil if the path contains | |
/// no points. | |
var currentPoint: CGPoint? { get } | |
/// Returns a path constructed by applying `transform` to all | |
/// points of `self`. | |
func applying(_ transform: CGAffineTransform) -> Path | |
/// Returns a path constructed by translating `self` by `(dx, dy)`. | |
func offsetBy(dx: CGFloat, dy: CGFloat) -> Path | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment