8
CAShapeLayer
에서 수행 된 CGPath
(두 개의 원이있는 폴리)이 있습니다.CGPath에서 CGPath를 잘라내거나 뺍니까?
이와 같은 경로를 자르거나 뺄 수 있습니까?
CAShapeLayer
에서 수행 된 CGPath
(두 개의 원이있는 폴리)이 있습니다.CGPath에서 CGPath를 잘라내거나 뺍니까?
이와 같은 경로를 자르거나 뺄 수 있습니까?
은 수학을 대신에, 결과는 kCGBlendModeClear
를 사용하여 시간을 그리기에 달성 될 수있다.
// Create the poly.
CGContextBeginPath(context);
CGContextMoveToPoint (context, a_.x, a_.y);
CGContextAddLineToPoint (context, b_.x, b_.y);
CGContextAddLineToPoint (context, c_.x, c_.y);
CGContextAddLineToPoint (context, d_.x, d_.y);
CGContextClosePath(context);
// Draw with the desired color.
CGContextSetFillColorWithColor(context, self.color.CGColor);
CGContextFillPath(context);
// Create a circle.
CGContextBeginPath(context);
CGContextAddEllipseInRect(context, (CGRect){
b_.x - self.radius,
b_.y - self.radius,
self.radius * 2.0,
self.radius * 2.0 });
CGContextClosePath(context);
// Draw with Clear (!) blend mode.
CGContextSetBlendMode(context, kCGBlendModeClear);
CGContextSetFillColorWithColor(context, self.color.CGColor);
CGContextFillPath(context);
짧은 대답 : 아니요 긴 대답 : 당신은 할 수 있지만 꽤 어렵습니다. –
고마워 :) 나는 레이어 마스크를 폴백으로 추가하여이 작업을 수행 할 수 있지만 래스터 화 패스를 고수하고 싶었고 수학을 선호했다. – Geri
+1 그림 – Norbert