I am planing to create a four point gradient, pictured below, by drawing two linear gradients via core graphics and masking between them with a third black and white linear gradient.
Is there a more efficient way to draw a four point gradient using core graphics, or other?
Draw four circles:
Apply radial transparent gradient:
Result:
Notes:
You can save the mask gradient when you use a CGBlendMode. It's just harder to control the exact colors. But if that's not important for you, it could be a little more efficient in terms of lines of code and maybe also in terms of performance.
Here's an example with some random colors and CGBlendModeExclusion (CGBlendModeDifference gives you a similar effect)