Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)updateMask{
- // float newW = endPoint.x - startPoint.x;
- // float newH = endPoint.y - startPoint.y;
- mask.frame = self.layer.bounds;
- CGRect biggerRect = CGRectMake(mask.frame.origin.x,
- mask.frame.origin.y,
- mask.frame.size.width,
- mask.frame.size.height);
- // maskRect = CGRectMake(startPoint.x, startPoint.y, newW, newH);
- UIBezierPath *maskPath = [UIBezierPath bezierPath];
- [maskPath moveToPoint:CGPointMake(CGRectGetMinX(biggerRect), CGRectGetMinY(biggerRect))];
- [maskPath addLineToPoint:CGPointMake(CGRectGetMinX(biggerRect), CGRectGetMaxY(biggerRect))];
- [maskPath addLineToPoint:CGPointMake(CGRectGetMaxX(biggerRect), CGRectGetMaxY(biggerRect))];
- [maskPath addLineToPoint:CGPointMake(CGRectGetMaxX(biggerRect), CGRectGetMinY(biggerRect))];
- [maskPath addLineToPoint:CGPointMake(CGRectGetMinX(biggerRect), CGRectGetMinY(biggerRect))];
- [maskPath moveToPoint:CGPointMake(CGRectGetMinX(controlsRect), CGRectGetMinY(controlsRect))];
- [maskPath addLineToPoint:CGPointMake(CGRectGetMinX(controlsRect), CGRectGetMaxY(controlsRect))];
- [maskPath addLineToPoint:CGPointMake(CGRectGetMaxX(controlsRect), CGRectGetMaxY(controlsRect))];
- [maskPath addLineToPoint:CGPointMake(CGRectGetMaxX(controlsRect), CGRectGetMinY(controlsRect))];
- [maskPath addLineToPoint:CGPointMake(CGRectGetMinX(controlsRect), CGRectGetMinY(controlsRect))];
- mask.path = maskPath.CGPath;
- [mask setFillRule:kCAFillRuleEvenOdd];
- mask.fillColor = [[UIColor redColor] CGColor];
- self.layer.mask = mask; // This should probably handle its own mask later..
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement