Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyome22/booleanpath
Add boolean operations to NSBezierPath like the pathfinder of Adobe Illustrator.
https://github.com/kyome22/booleanpath
Last synced: 3 months ago
JSON representation
Add boolean operations to NSBezierPath like the pathfinder of Adobe Illustrator.
- Host: GitHub
- URL: https://github.com/kyome22/booleanpath
- Owner: Kyome22
- License: mit
- Created: 2018-10-23T17:21:30.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-10T11:52:19.000Z (about 1 year ago)
- Last Synced: 2024-10-11T19:46:59.830Z (3 months ago)
- Language: Swift
- Homepage:
- Size: 702 KB
- Stars: 17
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BooleanPath for macOS
Add boolean operations to NSBezierPath like the pathfinder of Adobe Illustrator.## About BooleanPath
This is a rewrite of [VectorBoolean](https://github.com/lrtitze/Swift-VectorBoolean) written by Leslie Titze's.
BooleanPath is written by Swift for macOS.## Installation
### CocoaPods
```
pod 'BooleanPath'
```### Carthage
```
github "Kyome22/BooleanPath"
```## Demo
The sample code is in the project.
![sample](https://github.com/Kyome22/BooleanPath/blob/master/images/sample.png)
## Usage (Example)
```swift
import Cocoa
import BooleanPathlet rectPath = NSBezierPath(rect: NSRect(x: 10, y: 30, width: 60, height: 60))
let circlePath = NSBezierPath(ovalIn: NSRect(x: 25, y: 15, width: 50, height: 50))
// Union
let unionPath: NSBezierPath = rectPath.union(circlePath)
unionPath.fill()// Intersection
let intersectionPath: NSBezierPath = rectPath.intersection(circlePath)
intersectionPath.fill()
// Subtraction
let subtractionPath: NSBezierPath = rectPath.subtraction(circlePath)
subtractionPath.fill()
// Difference
let differencePath: NSBezierPath = rectPath.difference(circlePath)
differencePath.fill()
```