https://github.com/meniny/davinci
🖌 More modern CoreGraphics wrapper for iOS/macOS
https://github.com/meniny/davinci
cgcontext cgpath coregraphics ios
Last synced: about 1 year ago
JSON representation
🖌 More modern CoreGraphics wrapper for iOS/macOS
- Host: GitHub
- URL: https://github.com/meniny/davinci
- Owner: Meniny
- License: mit
- Created: 2018-01-20T10:09:13.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-19T12:34:03.000Z (about 8 years ago)
- Last Synced: 2025-03-24T01:14:26.731Z (about 1 year ago)
- Topics: cgcontext, cgpath, coregraphics, ios
- Language: Swift
- Homepage:
- Size: 618 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE.md
Awesome Lists containing this project
README
:name: DaVinci
:author: Elias Abel
:author_esc: Elias%20Abel
:mail: admin@meniny.cn
:desc: a more modern CoreGraphics wrapper for iOS/macOS.
:icon: {name}.png
:version: 2.0.0
:na: N/A
:ios: 10.0
:macos: 10.10
:watchos: {na}
:tvos: {na}
:linux: {na}
:xcode: 9.3
:swift: 4.1
:license: MIT
:sep: %20%7C%20
:platform: iOS{sep}macOS
= Meet `{name}`
{author} <{mail}>
v{version}, 2018-05-08
[subs="attributes"]
++++
++++
:toc:
== 🏵 Introduction
**{name}** is {desc}.
== 📋 Requirements
[%header]
|===
2+^m|Type 1+^m|Requirement
1.5+^.^|Platform ^|iOS ^|{ios}+
^|macOS ^|{macos}
^|tvOS ^|{tvos}
^|watchOS ^|{watchos}
^|Linux ^|{linux}
^|IDE ^|Xcode ^| {xcode}+
^|Language ^|Swift ^| {swift}+
|===
== 📲 Installation
=== CocoaPods
`{name}` is available on link:https://cocoapods.org[CocoaPods].
[source, ruby, subs="verbatim,attributes"]
----
use_frameworks!
pod '{name}'
----
=== Manually
Copy all files in the `{name}` directory into your project.
== 🛌 Dependency
{na}
== ❤️ Contribution
You are welcome to fork and submit pull requests.
== 🔖 License
`{name}` is open-sourced software, licensed under the link:./LICENSE.md[`{license}`] license.
== 🔫 Usage
.Sample.swift
[source, swift, subs="verbatim,attributes"]
----
import {name}
public func draw(in context: CGContext, rect: CGRect) {
let fillColorOne: CGColor = #colorLiteral(red: 0.05, green:0.49, blue:0.98, alpha:0.8).cgColor
func cal(_ ref: CGFloat, _ acu: CGFloat) -> CGFloat {
let reference: CGFloat = 66
return (ref / reference) * acu
}
let arrowPartTop = DaVinci.Path.init(point: CGPoint.init(x: cal(11, rect.width), y: rect.midY))
.addLine(to: CGPoint.init(x: cal(44.5, rect.width), y: 0))
.addLine(to: CGPoint.init(x: cal(54, rect.width), y: cal(9.5, rect.height)))
.addLine(to: CGPoint.init(x: cal(30, rect.width), y: rect.midY))
.close()
let arrowPartBottom = arrowPartTop.flip(.vertically, by: rect.midY)
let arrow = arrowPartTop + arrowPartBottom
context.fill(path: arrow, color: fillColorOne)
}
----
image::./Assets/Sample.png[Sample]