-(void)addBlankFrames:(NSArray<__kindof NSValue *> *)frames {
UIBezierPath *path = self.blankPath?:[UIBezierPath bezierPath];
CGRect oldRect = CGRectZero;
for (NSValue *value in frames) {
CGRect frame = [value CGRectValue];
UIBezierPath *p = [UIBezierPath bezierPathWithRect:frame];
if (oldRect.size.width > 0 && oldRect.size.height > 0) {
[p appendPath:[[UIBezierPath bezierPathWithRect:CGRectIntersection(frame, oldRect)] bezierPathByReversingPath]];
}
[path appendPath:p];
oldRect = frame;
}
[path closePath];
self.blankPath = path;
UIBezierPath *showPath = [UIBezierPath bezierPathWithRect:self.blackLayer.bounds];
[showPath appendPath:[self.blankPath bezierPathByReversingPath]];
[self.blackLayer setPath:showPath.CGPath];
}
-(void)hideNoBlankFrames:(NSArray<__kindof NSValue*> *)frames {
UIBezierPath *path = self.blankPath?:[UIBezierPath bezierPath];
for (NSValue *value in frames) {
CGRect frame = [value CGRectValue];
UIBezierPath *p = [UIBezierPath bezierPathWithRect:frame];
[path appendPath:p];
[path appendPath:p];
}
[path closePath];
self.blankPath = path;
UIBezierPath *showPath = [UIBezierPath bezierPathWithRect:self.blackLayer.bounds];
[showPath appendPath:[self.blankPath bezierPathByReversingPath]];
[self.blackLayer setPath:showPath.CGPath];
}