Re: An NSShadow question
Re: An NSShadow question
- Subject: Re: An NSShadow question
- From: Steve Sims <email@hidden>
- Date: Fri, 2 Apr 2004 15:42:41 -0500
Hi Eric,
Thanks for the reply.
I tried the technique you outline below, but I still get the same
strange double border effect where my fill overlaps the stroked path of
my bezier. It of course solves the problem of the fill shadow being
drawn over the stroked path.
I've posted a separate message to the list including code which better
demonstrates the problem I've been seeing and a core graphics-based
solution.
Regards,
Steve
On 2 Apr 2004, at 14:04, Eric Forget wrote:
Hi Steve,
I've come with the same problem a few weeks ago.For my problem it is
the
user that choose the border size, color, transparency. The same thing
for
the filling. My solution was this:
1) [NSGraphicsContext saveGraphicsState];
2) NSShadow setup...
3) Stroke the path
4) Fill the path
5) [shadowContext restoreGraphicsState];
6) Stroke the path again, this time over the shadow.
I know it may be costly, in some cases, to stroke the path twice, but
it
works. However, it is probably a lot less costly than filling twice. I
never heard about TLayer. I should probably look at it.
I hope it will help you.
Eric
NSShadow is a really nice idea, but I don't seem to be able to get it
to do quite what I want.
Here's the problem. I have a closed bezier in an NSBezierPath object
with a wide outline (about 10 units). I set up an NSShadow with a
reasonable offset (about 20, 20 units) and apply it using the set
method so that when I draw my bezier I'll get a shadow. I then draw
my
bezier using stroke then fill. The shadow that gets drawn has a
darker
section of shadow where the stroke and fill overlap. Also the shadow
for the fill is rendered on top of the stroked path. This looks
bizarre and is not what I want.
Now the Quartz TLayer sample code kind of solves this problem with all
shadows being drawn behind all other drawn objects, however it manages
this by not using NSShadow, but rather using CG API calls. It does
this by using a transparency layer.
I tried to use the same CG API calls that TLayer uses together with
NSShadow, but this does not work - the CG calls seem to be ignored.
My
solution has been to abandon using NSShadow.
So my question is do I really have to abandon NSShadow, or is there a
way to persuade it to work with a transparency layer?
___________________________________________________________________
Eric Forget Cafederic
email@hidden <http://www.cafederic.com/>
Fingerprint <86D5 38F5 E1FD 5D9C 71C3 BAA3 797E 70A4 6210 C684>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.