I am trying to apply a greyscale and slight blur to a portion of my app interface. The portion can be captured using display.capture() and the fill effect applied to the capture object. Essentially, what I’m trying to achieve is an iOS style frosted glass effect (not the Corona frosted glass, which is much more speckled.)
Here is the screen portion I’m trying to apply a simple grey/blur to:
With a slight gaussian blur and greyscale filter applied, this is what the image would look like in PhotoShop (actually, Acorn for Mac):
The code I am using to apply these effects is this:
local function blur( obj ) local capture = display.capture( obj ) capture.fill.effect = "filter.blurGaussian" capture.fill.effect.horizontal.blurSize = 40 capture.fill.effect.horizontal.sigma = 40 capture.fill.effect.vertical.blurSize = 40 capture.fill.effect.vertical.sigma = 40 -- capture.fill.effect = "filter.grayscale" -- commented out because I can't apply two effects capture.x, capture.y = obj.x, obj.y return capture end
This results in this:
I face two problems here:
- How to apply two effects (blur, greyscale)
- How to apply them evenly, as PS does
Can anyone help me out here, please?