- CPBezierPath addClip and setClip.

This enables e.g. a `CPGradient` to be drawn clipped by an arbitrary bezier path.
This commit is contained in:
Alexander Ljungberg
2012-10-22 15:02:28 +01:00
parent eba3e95b81
commit 391701fdc7
+17
View File
@@ -306,4 +306,21 @@ var DefaultLineWidth = 1.0;
_path = CGPathCreateMutable();
}
- (void)addClip
{
var ctx = [[CPGraphicsContext currentContext] graphicsPort];
CGContextAddPath(ctx, _path);
CGContextClip(ctx);
}
- (void)setClip
{
var ctx = [[CPGraphicsContext currentContext] graphicsPort];
CGContextBeginPath(ctx);
CGContextAddPath(ctx, _path);
CGContextClip(ctx);
}
@end