Drop Shadow for Text
-
Currently it's not possible to drop-shadow text, as text cannot be added to a path object. Goes for paint routines and LAF.
The missing method would either draw drop shadow for the text, could use the same parameters like drawAlignedText, with added radius of course.
-
@aaronventure Does
addDropShadowFromAlpha
work? -
@d-healey on a panel paint routine no, that's meant for inset shadow, shading on top of the text itself.
Also it breaks if you zoom past 200%, at least in HISE
-
Yes, this should work:
const var Panel1 = Content.getComponent("Panel1"); Panel1.setPaintRoutine(function(g) { g.setColour(Colours.red); g.setFont("Lato Bold", 24.0); g.drawAlignedText("FUNKY", this.getLocalBounds(0), "centred"); g.addDropShadowFromAlpha(Colours.red, 15); g.setColour(Colours.white); g.drawAlignedText("FUNKY", this.getLocalBounds(0), "centred"); });
The melatonin blur has a text shadow renderer, so in the long run this will find its way into the HISE Graphics API, but it's not on my immediate TODO list.
-
Also it breaks if you zoom past 200%
Everything breaks if you zoom past 200% (with retina displays you're then at 400% zoom and I had to cap it somewhere).
-
@Christoph-Hart Alright gotcha, this is good enough for now.
It seems like the shadow is always the same size no matter the zoom (drop shadow from path scales with zoom properly) and there's a size cap as well?