0
코어 그래픽을 사용하여 두 개의 직사각형 모양의 경로를 만들려고합니다. 색상을 사용하여 패스를 채우려고하면 겹쳐진 색상이 채워지지 않습니다.CoreGraphics - 색상이 채워지지 않은 겹치는 경로 영역
는 출력
내가 녹색 컬러 모두 폐쇄 구역을 채워 져야 할
- (void)drawRect:(CGRect)rect {
CGPoint topLeft = CGPointMake(121, 116);
CGPoint topRight = CGPointMake(221, 216);
CGPoint middleLeft = CGPointMake(121, 180);
CGPoint middleRight = CGPointMake(221, 280);
CGPoint bottomLeft = CGPointMake(250, 56);
CGPoint bottomRight = CGPointMake(350, 156);
CGMutablePathRef subpath1 = CGPathCreateMutable();
CGPathMoveToPoint(subpath1, NULL, topLeft.x, topLeft.y);
CGPathAddLineToPoint(subpath1, NULL, topRight.x, topRight.y);
CGPathAddLineToPoint(subpath1, NULL, middleRight.x, middleRight.y);
CGPathAddLineToPoint(subpath1, NULL, middleLeft.x, middleLeft.y);
CGPathAddLineToPoint(subpath1, NULL, topLeft.x, topLeft.y);
CGPathCloseSubpath(subpath1);
CGMutablePathRef subpath2 = CGPathCreateMutable();
CGPathMoveToPoint(subpath2, NULL, middleLeft.x, middleLeft.y);
CGPathAddLineToPoint(subpath2, NULL, middleRight.x, middleRight.y);
CGPathAddLineToPoint(subpath2, NULL, bottomRight.x, bottomRight.y);
CGPathAddLineToPoint(subpath2, NULL, bottomLeft.x, bottomLeft.y);
CGPathAddLineToPoint(subpath2, NULL, middleLeft.x, middleLeft.y);
CGPathCloseSubpath(subpath2);
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddPath(path, NULL, subpath1);
CGPathAddPath(path, NULL, subpath2);
CGPathCloseSubpath(path);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor colorWithRed:0.19 green:0.42 blue:0.09 alpha:1.0].CGColor);
CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:0.19 green:0.42 blue:0.09 alpha:1.0].CGColor);
CGContextSetBlendMode(context, kCGBlendModeMultiply);
CGContextSetAlpha(context, 1.0);
CGContextAddPath(context, path);
CGContextDrawPath(context, kCGPathFillStroke);
}
이다 사용되는 코드이다. 어떤 방법으로이 문제를 해결할 수 있습니까?