I am building up a view with various text and image elements.
I want to display some text in the view with a blurry copy of the text behind it, but not just a text shadow.
How do I apply Gaussian blurred text onto a UIImage or layer?
I am building up a view with various text and image elements.
I want to display some text in the view with a blurry copy of the text behind it, but not just a text shadow.
How do I apply Gaussian blurred text onto a UIImage or layer?
You will take a performance hit if you use alpha layers. Consider a different approach if possible (maybe even precompositing the text and flattening it into a graphic instead of multiple layers).
Try it, and use Instruments to check out the performance and see if it's acceptable. If you're doing it in a scrolling view, your scrolling will bog down a lot.
iPhone OS doesn't provide any Core Image filters that I know of - otherwise, yes, a filtered CALayer would be the right way to do it. If NSBitmapImageRep were available, you could do a primitive blur by drawing the text to it, shrinking the image (downsampling), then enlarging the image again (upsampling) - unfortunately it seems to be missing as well. I've seen blurred text accomplished in Flash, which (last I checked) doesn't have pixel-level filtering; you might try looking for a tutorial on that and seeing what you can adapt to Cocoa Touch.
On the desktop, no question, you'd use CoreImage to do this.
On the phone though, I don't think there exists a way to do this using CoreGraphics. If it is absolutely critical OpenGLES may be able to help.
However, I would suggest rethinking your interface. I would think the blurred text would be distracting.
Edit: mledford points out in the comments that you could use CoreAnimation. I don't know if CA on the phone includes blur radius like on the desktop, but you could try it.
Take a look at Apple's GLImageProcessing iPhone sample. It does some blurring, among other things.
The relevant code includes: