mchoe / SwiftSVG

A simple, performant, and lightweight SVG parser
Other
1.94k stars 229 forks source link

Use SVG as mask, revert the mask #126

Open Bathilde opened 5 years ago

Bathilde commented 5 years ago

I am currently using SwiftSVG to render masks on UIImageView and UIView.

If I want to revert a mask I normally do 3 things:

  1. path.usesEvenOddFillRule = true
  2. mask.fillColor = UIColor.white.cgColor
  3. mask.fillRule = .evenOdd

If I do the same steps on a SVGLayer, I don't see my mask being reverted.

Was this feature planned for the library ?

The mask I am using:

<svg viewBox=\"0 0 100 100\"><path d=\"M50 2.447l15.45 31.307 34.55 5.02-25 24.37 5.902 34.409L50 81.307 19.098 97.553 25 63.143 0 38.774l34.55-5.02z\" fill=\"#fff\" /></svg>

Simulator Screen Shot - iPhone 8 - 2019-04-11 at 16 04 45