mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
- CPBezierPath addClip and setClip.
This enables e.g. a `CPGradient` to be drawn clipped by an arbitrary bezier path.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user