This library adds categories to UIBezierPath to simplify clipping a single closed UIBezierPath with another closed or unclosed UIBezierPath.
The ClippingBezier.framework powers the scissors tool in Loose Leaf, and it allows for drawing to be clipped to any imported image scraps.
This library will generate a proper static framework bundle that can be used in any iOS7+ project.
- Link against the built framework and the included PerformanceBezier framework
- Add "-ObjC++ -lstdc++" to the Other Linker Flags in the project's Settings
- #import <PerformanceBezier/PerformanceBezier.h>
- #import <ClippingBezier/ClippingBezier.h>
This library depends on the UIBezierPath performance improvements in the PerformanceBezier library.
UIBezierPath* aClosedPath = /* some path */;
UIBezierPath* scissorPath = /* some other path */;
NSArray* subshapes = [aClosedPath uniqueShapesCreatedFromSlicingWithUnclosedPath:scissorPath];
for(DKUIBezierPathShape* shape in subshapes){
UIBezierPath* aClosedPathSlice = shape.fullPath;
}
Find intersections between two UIBezierPaths:
Or find the component shapes generated from two path's intersections
The Xcode workspace includes a ClippingExampleApp project that shows a fully functional integration of the ClippingBezier framework. You can refer to this example for any questions about how to integrate into your app.
The ClippingBezier framework and sample code are provided under the MIT License.
- Download Loose Leaf
- Follow @adamwulf on twitter.