Fr: make Path a bit more functional

right now most of the Path instance methods are void - if they did return *this instead the api would be chainable. so instead of this:

path.startNewPath(1,2);
path.lineTo(3,4);
path.lineTo(4,5);

you could do this:

path.startNewPath(1,2)
  .lineTo(3,4)
  .lineTo(4,5);
14 Likes

+100

+1000

juce folks - is this something you’d accept a pr for?

What about making a bunch of helper classes that could be chained with << ?

So that the resulting code could be:

Path p
p << StartNewPath (1, 2) << LineTo (3, 4) << LineTo (4, 5); 

A little more verbose, but these could easily be developed as separate classes that don’t need changing JUCE at all

4 Likes