Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Stroking a path using a gradient
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stroking a path using a gradient




Am 24.08.2008 um 17:13 schrieb David Duncan:

On Aug 24, 2008, at 2:34 AM, Frank Illenberger wrote:

does anybody know if there is a way in Quartz under Mac OS 10.5 to stroke a path with a gradient/shading but without using a pattern color?


What effect are you trying to achieve?

Thanks David,
I want to fill a shape with a gradient and then stroke the contour of the shape with a dashed line whose color should also change according to the gradient. Under Tiger I used to solve this by drawing a solid gradient in to an NSImage, then turning this image into a pattern color by using colorWithPatternImage:, setting the correct pattern phase for my drawing location and then simply fill and stroke the path. Now, under Leopard I want to get rid of the overhead of creating NSImages and pattern colors.



You can use CGContextReplacePathWithStrokedPath() followed by CGContextClip() to do some types of effects, but depending on what you are specifically trying to do this may or may not be what your looking for.

This sounds like a solution to my problem. I will try if it works.
By the way: Do you know what the best solution is for drawing a drop shadow together with a gradient fill? As regular gradient drawing uses clipping, every shadow drawn outside of the shape naturally gets clipped. I currently solve this by filling the path with a solid color plus a shadow and then filling the gradient on top of this. Do you know if there is a way to avoid this double filling of the shape?


Cheers

Frank

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Stroking a path using a gradient (From: Frank Illenberger <email@hidden>)
 >Re: Stroking a path using a gradient (From: David Duncan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.