I do it manually, see here. Maybe it’s possible to adapt the idea to create a brush (I can’t help on this part…).