NSGradient draws incorrectly in PDF context?
NSGradient draws incorrectly in PDF context?
- Subject: NSGradient draws incorrectly in PDF context?
- From: Graham Cox <email@hidden>
- Date: Thu, 12 Mar 2009 23:48:12 +1100
I've noticed I'm getting different results with NSGradient when
drawing to screen and when drawing in a PDF context, e.g. printing, or
write PDF to clipboard. If the gradient contains colours with
transparency, it draws correctly on-screen (allowing what's drawn
behind to come through), but draws opaquely in PDF.
I have tried forcing the compositing operation of the context to
NSCompositeSourceOver just before drawing the gradient, but to no avail.
Anyone else noticed this, or am I doing something wrong? Example code
fragment below:
NSGradient* grad = [[NSGradient alloc] initWithStartingColor:
[[NSColor whiteColor] colorWithAlphaComponent:0.2] endingColor:
[NSColor blackColor]];
// set up of start/end points and path not shown
[NSGraphicsContext saveGraphicsState];
[path addClip];
[[NSGraphicsContext currentContext]
setCompositingOperation:NSCompositeSourceOver];
[grad drawFromCenter:sp radius:sr toCenter:ep radius:er
options:NSGradientDrawsBeforeStartingLocation |
NSGradientDrawsAfterEndingLocation];
[NSGraphicsContext restoreGraphicsState];
--Graham
_______________________________________________
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