Many thanks David. That did the trick.

Regards
-- Leonardo


> Da: David Duncan <[email protected]>
> Data: Wed, 01 Jan 2014 17:44:01 -0800
> A: Leonardo <[email protected]>
> Cc: Cocoa-dev <[email protected]>
> Oggetto: Re: NSShadow with [bezierPath addClip]
> 
> In CoreGraphics the way you would do this is to setup your shadow parameters,
> then start a transparency layer, do your drawing there, then composite that
> back to the original context. Something like this:
> 
> CGContextSetShadow(context, shadowOffset, shadowBlur);
> CGContextBeginTransparencyLayer(context, NULL);
> // do your drawing
> CGContextEndTransparencyLayer(context);
> 
> You could get the graphicsPort from the NSGraphicsContext to call the
> transperancy layer methods and otherwise stick to NSGraphics stuff.
> 
> On Dec 31, 2013, at 4:15 AM, Leonardo <[email protected]> wrote:
> 
>> In my NSView subclass, I have to draw an image within a bezierPath and apply
>> an NSShadow to the result.
>> So within the drawRect: method I add
>> 
>>     [bezierPath addClip];
>>     [mImage drawInRect:inRect fromRect:fromRect
>> operation:NSCompositeSourceOver fraction:mOpacity];
>> 
>> It works. The image gets clipped by the path.
>> Now I would like to apply the NSShadow to the result, so before those lines
>> above I add
>> 
>> [bezierPath addClip];
>> [mShadow set];
>> [mImage drawInRect:inRect fromRect:fromRect operation:NSCompositeSourceOver
>> fraction:mOpacity];
>> 
>> I can't get the shadow drawn because the bezierPath is clipping the drawing
>> area where the shadow should fall.
>> How to solve this trouble?
>> I have tried to use a layer, but I get weird results when I resize, rotate
>> and modify other parameters of the view.
>> 
>> 
>> Regards
>> -- Leonardo
>> 
>> 
>> _______________________________________________
>> 
>> Cocoa-dev mailing list ([email protected])
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
>> 
>> This email sent to [email protected]
> 
> --
> David Duncan
> 


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to