Re: Is there a fast NSShadow alternative?
Re: Is there a fast NSShadow alternative?
- Subject: Re: Is there a fast NSShadow alternative?
- From: Alastair Houghton <email@hidden>
- Date: Tue, 10 Jul 2007 19:29:20 +0100
On 10 Jul 2007, at 17:46, Alan Smith wrote:
One way I could get the effect I'm looking for would be to create a
CIImage with the stroked path in it and then blur it. This is too slow
and not simple enough.
I think this is pretty much how NSShadow works, as it happens (it
probably doesn't use Core Image though).
I could also make an inner glow by stroking a path in between calls to
CGContextBeginTransparencyLayer and CGContextEndTransparencyLayer and
blurring the context. The only problem is I don't know how to blur the
context except by going through CoreImage which I don't want to do.
Well you could create a temporary image (as we're talking Cocoa here,
an NSBitmapImageRep), then use NSGraphicsContext's
+graphicsContextWithBitmapImageRep: method to get a graphics context,
stroke the path into that, then blur the image using e.g.
vImageConvolve_ARGB8888() (or by doing it directly yourself). This
is probably more complicated than using CoreImage though, I should
think.
I don't think you're missing a CoreGraphics function, by the way; I
just don't think there's a function to blur the current contents of a
CGContext.
You might be able to achieve a similar effect to the one you're after
by using a shading instead (see CGShadingCreateRadial(), for
instance). That would almost certainly be faster than blurring an
image, I should think.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden