High speed shadows
High speed shadows
- Subject: High speed shadows
- From: Gideon King <email@hidden>
- Date: Thu, 3 May 2001 20:35:55 +0800
Does anybody know a *fast* way to draw shadows like what is drawn for
window shadows?
Some time ago, I asked on the omni list how to create drop shadows that
look exactly like the ones around windows, for graphic objects in my
graphic application I'm writing. It was suggested that I draw into
another image rep with the appropriate color and do a gaussian blur on
it. I implemented that (using standard algorithms, and using pointer
arithmetic etc for speed) and it works, but it is pretty slow (8s for a
600x300 image on my G4 cube). I am using color images at the moment, so
could presumably use grayscale alpha and also do some optimization to
reduce the time taken, but I still think it is probably still going to
be too slow.
I knew that the shadows on the windows in OSX drew their shadows much
faster, but I assumed that they were stretching an image for the sides
and compositing images for the corners (something I can't do for all my
graphics). Now that I have played with the transparency of terminal app
and seen that it draws shadows on the text you type, and have also
played with the circular window example from Apple it is clear that they
do the whole blur thing on the fly with the whole image. As far as I can
see, there is no public API to create shadows (apart from
adding/removing them from windows).
Any suggestions of a faster way would be greatly appreciated.
TIA
Gideon King.