Layers and Gaussian blurs.....
-
Okay can anyone explain this to me?
I'm trying to draw a button with a rectangle around its edge and some text inside - all possible,
now I'd like to add an ellipse and to have it blurred...
I have this code in my laf callback
laf.registerFunction("drawToggleButton", function(g, obj) { var a = obj.area; g.beginLayer(true); g.setColour(obj.bgColour); g.drawRect([0,10,a[2],a[3]-20],1+ obj.value); g.drawAlignedText(obj.text, [0,10,a[2],a[3]-20], "centred"); g.endLayer(); if (obj.value) { g.beginLayer(true); g.setColour(obj.itemColour1); g.fillEllipse([0,a[3]-10,a[2],5]); g.gaussianBlur(3); g.endLayer(); } });
This just blurs everything when the button is on, so I clearly dont understand how to use layers - or they are not supposed to be used to get this effect, and if not how do I do it?
-
@lindon --and random value setting comes to the rescue again - why oh why is none of this documented anywhere?
do this:
laf.registerFunction("drawToggleButton", function(g, obj) { var a = obj.area; g.beginLayer(true); g.setColour(obj.bgColour); g.drawRect([0,10,a[2],a[3]-20],1+ obj.value); g.drawAlignedText(obj.text, [0,10,a[2],a[3]-20], "centred"); g.endLayer(); if (obj.value) { g.beginLayer(false); g.setColour(obj.itemColour1); g.fillEllipse([0,a[3]-10,a[2],5]); g.gaussianBlur(3); g.endLayer(); } });
see that false there in the second layer?