SVGKit/SVGKit — pull request #192 by dgileadi (2014-08-11 16:59:35+00:00)
Title: Support for clip path

Adds support for <clipPath> and the clip-path attribute. <clipPath> elements aren't rendered as part of the normal display but if they're referenced in a clip-path attribute then they clip the element that references them.

This implementation uses the CALayer's mask property to do the masking. This is not entirely correct since the definition of <clipPath> requires no alpha blending (except for anti-aliasing) while CALayer's mask property does support anti-aliasing, but most uses of <clipPath> don't contain alpha in their path definitions so this generally won't be a problem in practice. As a side note CALayer's mask property could also easily (and more correctly) be used to implement <mask>. I don't plan to do this however.

The Coins.svg sample in the demos has been changed to use <clipPath> to clip the images over a gray background.