Apply Glow Effect to a Path

Idiot here seeking advice on paths.
So I made a custom slider that runs a path to create a lit up dial ring around the custom rotary slider.
However, I want to apply a glow effect to that dial ring.
Now there is a GlowEffect class and I want to apply a glow effect to that path. However, the argument for GlowEffect are :
GlowEffect::applyEffect (Image& image, Graphics& g, float scaleFactor, float alpha)

My relevant code is as follows:
/*create glow effect*/
GlowEffect dialRingGlowEffect;
Colour glowColour = Colour(0x70ff0000);
Point<int>() = { bounds.getCentreX(), bounds.getCentreY() }
g.strokePath(valueArc, PathStrokeType(lineW/4));
dialRingGlowEffect.applyEffect(/*need some sort of image here*/, g, 1, 0.6);

How do I correctly assign my valueArc, which is a Path Object, to the image parameter argument?

Please help me Obi-wan Kenobi you are my only hope.

Haven’t directly tried this, but I believe you would render the path to an offscreen context, apply the glow to that, then add the resulting image to your scene, like so:

Image myImage (Image::ARGB, 600, 400, false);
Graphics tmp (myImage);
tmp.strokePath, etc…
dialRingGlowEffect.applyEffect(myImage, tmp, 1, 1);

Or something like that. That should head you down the right path. (Pun, of course, intended.)

1 Like

As an aside, I think, if you’re making an audio plugin and this is just for normal knobs (that don’t have visual mod update or anything), it might be better to pre-render 127 or so of them on instance and hold them in RAM, rather than doing an on-the-fly glow. I think that’s how I’d approach it anyhow, especially if you have a lot of knobs. These sorts of things are quite costly.


thanks for the speedy reply.

ya, i think I’m just going to design a different aesthetic but I might use this elsewhere.

At that time I will say if I can use it but that seems to make sense to me.

btw I love the ADM21.

1 Like