Я нарисовал UIBezierPath в Objective-C и наполнил его красным цветом. Теперь я хочу заполнить путь несколькими цветами на основе процента. Например: я хочу заполнить путь зеленым цветом 20%, а остальные 80% - красным, поверх друг друга (а не градиентом). Я также хочу несколько пикселей между заполнением и штрихом.iOS - Fill bezierPath с несколькими цветами на основе процента
Я не знаю, как я могу это осуществить. Кто-нибудь знает, как я могу это сделать или указать мне в правильном направлении?
Большое спасибо заранее!
UIBezierPath* bezierPath = UIBezierPath.bezierPath;
[bezierPath moveToPoint: CGPointMake(50, 50)];
[bezierPath addLineToPoint: CGPointMake(60, 90)];
[bezierPath addLineToPoint: CGPointMake(80, 90)];
[bezierPath addLineToPoint: CGPointMake(90, 50)];
bezierPath.lineCapStyle = kCGLineCapRound;
bezierPath.lineJoinStyle = kCGLineJoinBevel;
[UIColor.redColor setFill];
[bezierPath fill];
[UIColor.blackColor setStroke];
bezierPath.lineWidth = 4;
[bezierPath stroke];
Ваш вопрос остается неясным. Вы хотите заполнить путь одним цветом, который представляет собой смесь 20% зеленого и 80% красного? Или вы хотите заполнить 20% пикселей внутри пути зеленым, а оставшиеся 80% пикселей с красным? –
Извините; Я хочу заполнить 20% пикселей внутри пути зеленым, а оставшиеся 80% пикселей с красным – user3767163