• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSGradient draws incorrectly in PDF context?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSGradient draws incorrectly in PDF context?
      • From: Benjamin Stiglitz <email@hidden>
  • Prev by Date: Re: NSMakeSize and correct type
  • Next by Date: Performance problem with GC enabled
  • Previous by thread: Re: NSMakeSize and correct type
  • Next by thread: Re: NSGradient draws incorrectly in PDF context?
  • Index(es):
    • Date
    • Thread