I'm thinking about a nice rescalable GUI for the next plugin. So, I"ve made myself some software rendered sliders which match the PNG based ones I used in Gimp for the last plugin. See below. They rescale really nicely, and I don't have to use GIMP if I want them in a different colour, or with a knurled grip, a different angled light or whatever. It's awesome!
But I've got some issues:
DropShadow takes about 80% of the CPU when resizing even one knob. The rest of the code is surprisingly quick. Options: (a) don't draw the shadow when resizing (b) cache the shadow (c) write a quicker shadow routine ...
Should I centre the knob in the component? I'm thinking I need to even if that makes the component bigger it'll be really annoying to try and line things up otherwise!
Integration with Slider
There's quite a lot of pre-calcuation of stuff, Paths, tangents for the shadow (thanks Pi!) and other bits. I guess I'm going to have to (a) subclass Slider (b) override resized() to do the pre-calcuation (c) put the rendering code into a LookAndFeel class (d) dynamic_cast the Slider& that gets passed to look and feel back to my slider subclass and get the precalcuation stuff from there.
Unless anyone can think of a tidier method?
Because the shadow can extend down and right quite a long way, I'm wondering if the Slider shouldn't own two components, the knob and the shadow overlay so that the knob size itself is nice and tightly specified by mySlider.setBounds(.....) and then the shadow happens on top.
Any thoughts greatly appreciated, or failing that at least I've documented my list of problems :)