How do I create a RelativePointPath?


I want to create a simple DrawablePath which uses a RelativePointPath. But I don’t really understand how RelativePoint works. I tried this:

RelativePointPath rp;
rp.addElement(new RelativePointPath::StartSubPath(RelativePoint("left, bottom")));
rp.addElement(new RelativePointPath::LineTo(RelativePoint("right, top")));

But when I add drawablePath to my component, the program crashes. It’s just supposed to be a diagonal line for now.


TBH I’d recommend avoiding those RelativePoint classes. They were essentially an experiment I did about 5 years ago which I wasn’t happy with, and would eventually like to deprecate them to avoid confusion.

The reason it was a failed experiment is that in almost all cases it’s much easier and quicker to just generate the path you need when you want to draw it, rather than trying to build a smart object to do this for you.