Υου’ll wonder why is that useful… Well for a number of reasons and for creating the shadowPath of a path!
If you want to render some paths with their shadow, you can set the CALayer‘s properties:
mycalayer.shadowOpacity = 0.8;
But if you don’t specify a shadowPath, the layer’s alpha channel will be used which is slow for real time changes. The solution is to specify a CGpath as the shadowPath. But apple doesn’t give you a function that creates a shadowPath around your path. So… I’ve written one!
The function accepts an open or closed CGpath and the desirable width for the outline and returns the outline as a closed CGpath. It uses the Acclerate Framework for faster calculations.
I have created a demo that animates the outline’s width as well as the rotation of a path. The outline of one of the paths is used as a shadowPath. You can find the function inside this demo project here: https://github.com/Petrakeas/outlineDEMO
A video of the demo follows and some technical details.
UPDATE: I have added some more functions that help in the creation of bezier curves and updated the demo accordingly. Read the post here.