One of the things that has initially bothered me when utilizing the HColorPool class has been the inability to make sure small pool counts don't continually repeat the same colors in HShapes with similar amounts of children. When using shapes with adjacent children (see example images below) quite often those children will share the same color. By instead of randomly sourcing an index and grabbing a color, this PR updates the HColorPool class to also store an additional list of colors, randomize them once, and then subsequently pull them off the head of the array every time getColor() is called when the flag to repeat colors is set to false. A slight change to HShape's randomColors makes sure to reset the stack every time it is called so that the color pool doesn't accidentally repeat colors in the pool by starting the randomization with a stack that doesn't match the size of the pool. As you can see in the generated images, the effect is subtle, but very satisfying depending on application.
usage:
colorPool = new HColorPool(#F7F7F7, #0095A8, #FF3300, #FF6600).repeatColors(false);
I generated the javadocs for this PR with open jdk 14 and it appears to have changed quite a bit here, and while I kinda appreciate the different UI a bit, I had to do some manual tweaks to get it working, which I have not included in the PR. What version of Java are you using to build the project? While compilation and sketchbook updating is seamless, generating the javadocs wasn't and I have a feeling it's my environment.
One of the things that has initially bothered me when utilizing the HColorPool class has been the inability to make sure small pool counts don't continually repeat the same colors in HShapes with similar amounts of children. When using shapes with adjacent children (see example images below) quite often those children will share the same color. By instead of randomly sourcing an index and grabbing a color, this PR updates the HColorPool class to also store an additional list of colors, randomize them once, and then subsequently pull them off the head of the array every time getColor() is called when the flag to repeat colors is set to false. A slight change to HShape's randomColors makes sure to reset the stack every time it is called so that the color pool doesn't accidentally repeat colors in the pool by starting the randomization with a stack that doesn't match the size of the pool. As you can see in the generated images, the effect is subtle, but very satisfying depending on application.
usage:
I generated the javadocs for this PR with open jdk 14 and it appears to have changed quite a bit here, and while I kinda appreciate the different UI a bit, I had to do some manual tweaks to get it working, which I have not included in the PR. What version of Java are you using to build the project? While compilation and sketchbook updating is seamless, generating the javadocs wasn't and I have a feeling it's my environment.
Repeats: No repeats: