How to join two different color lines using quartz?

Thus, according to the Apple 2D Quartz 2D Programming manual, there are a number of predefined line joining styles when related line segments in your path meet in the corner (Miter Join, Round Join, Bevel Join). I want to do this with different colored lines that I'm having problems with.

According to the discussion here: iPhone CGContext: drawing two lines with two different colors to change the color of the line at some point along the path, you have to split this path into two parts. It looks like you need to stroke the path with color1, switch colors, and then start a new path with color2. However, since I am splitting the path into two, this means that the join style is no longer applied, as it seems to only apply to line segments that join as part of the same path.

Any ideas?

+3
source share
1 answer

, , , , . Apple Quartz 2D:

. [...] - . . , .

:

  • kCGLineCapRound line kCGLineJoinRound , .

  • , , , . kCGLineCapSquare kCGLineCapButt kCGLineJoinMiter, .

, . CGPathCreateCopyByStrokingPath - ", , ".

+3

Source: https://habr.com/ru/post/1761670/


All Articles