Re: High speed shadows
Re: High speed shadows
- Subject: Re: High speed shadows
- From: Gideon King <email@hidden>
- Date: Thu, 3 May 2001 22:31:35 +0800
Thanks for the thought - I know that in some circumstances I could
potentially speed things up by only blurring part of the image, but my
images are sometimes text, sometimes images with transparent bits, etc.
The exceptions would probably mean that the effort would increase the
application complexity significantly for only a small gain.
The frustrating thing is that I have proof before my eyes (in the
circular window example) that there is a much faster way to do it!
Gideon.
On Thursday, May 3, 2001, at 10:27 PM, Raphael Sebbe wrote:
Just a simple thought :
Do you apply your blur algorithm on the whole image ? If yes, you
should try to find out a way of doing so on a region around the borders
of the original image. This would lead to dramatic improvements in
speed !
For example, if your image is m x n pixels, the first would require a
computation of the order of o(m x n), the latter of o(m + n), -> for
200 x 500 : 100,000 x C vs 700 x D. The tricky part (depending on what
you draw) would be to find borders...
Raphael
On Thursday, May 3, 2001, at 02:35 PM, Gideon King wrote:
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.