I’ve just uploaded a first draft of a new colour gradient designer class that might be useful to some people. This was mainly intended for TheVinn’s layer effects project but my hope is that it makes its way into the main JUCE tree as well. There is a simple demo which shows a simple way of designing a radial gradient. I didn’t bother to bundle the JUCE sources with it so you’ll just have to update the “Local JUCE Folder” path and re-save the Introjucer project for it re-fresh the locations.
The project is currently hosted on my GitHub here.
Its still a work in progress so any feedback is welcome, particularly feature requests and comments on expected behaviour. Here’s a quick list of things that would be helpful to know and some future features I’ll try to add:
- How should the colour selector be shown? On a marker right click or double click.
- How far should you have to drag markers off for them to be deleted?
- The ability to put markers back if you haven’t released the mouse when removing them.
- Overall opacity.
- Individual marker edit space for accurate positioning.
It’s nice tool,
It’w working fine. thanks for this one…
Cool! I actually have some half-written gradient designer code lying around… I could have given that to you as a starting point.
Yeh thanks, I did see that on the LayerEffects thread but decided to go a slightly different route and make the designed gradient linear to match most image editing applications. It works in a similar way to your’s though by broadcasting change messages when the gradient is changed. The user just has to grab a copy of the gradient and apply their own isRadial and co-ordinates to it. I suppose I could take a copy of these upon setGradient but I don’t really think this should be responsible for the application of the gradient, just the colours.
Oh yes, I forgot that I posted it a while back.
I’ll need a gradient designer for the projucer’s paint editor so will be looking at it all again sometime soonish.
Interesting stuff. I think what really needs to be done here, as discussed before is to separate the gradient from the implementation of how it is drawn (linear, radial, circular etc.). That way we could have a Gradient class which just specifies the colours and their proportions with an optional smoothness property to mimic the Photoshop implementation if necessary.