• 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
Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?


  • Subject: Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?
  • From: Michael Robinson <email@hidden>
  • Date: Sat, 4 Oct 2008 17:17:37 +1300

On 2/10/2008, at 5:29 AM, David Duncan wrote:

On Oct 1, 2008, at 5:46 AM, Michael Robinson wrote:

Unsurprisingly, I need my hand held again.

1. how do I initialize a CGShading object, with my two colours (left right/top bottom)

See the Quartz 2D Shadings sample at <http://developer.apple.com/samplecode/Quartz2DShadings/index.html >
The sample code runs on 10.5, but the shadings code should work on 10.4 as well (the sample only runs on 10.5 because it also uses the CGGradientRef APIs).



Thank you for this, but it confuses my feeble mind.

Instead I happened upon the "NSGradient" object, and used that while I built other parts of the image creation section of my plugin.

Now I'd like to replace this:

NSGradient* aGradient = [[[NSGradient alloc] initWithColorsAndLocations:[gradientColour1 color], (CGFloat)0.0, [gradientColour2 color], (CGFloat)1.0,nil] autorelease];

[aGradient drawInBezierPath:aPath angle:[gradientOpacitySlider floatValue]];


With a 10.4 compatible solution.

Though I'm sure the solution *is* in the project you referred me too, I can' t see it. I apologize for my ineptitude.

Is there a one-liner I can use to replace my current code?

Thank you for your patience

Mike


2. how do I fill my NSBitmapImageRep with this pretty gradient?


Create an NSGraphicsContext with the image rep, then get the CGContext from the NSGraphicsContext. The latter is shown in the sample above, although the former is not.
--
David Duncan
Apple DTS Animation and Printing



_______________________________________________

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: [Math] sin(), cos() not working? What special magic must I use to summon their powers?
      • From: Graham Cox <email@hidden>
References: 
 >Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers? (From: Alastair Houghton <email@hidden>)
 >Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers? (From: Michael Robinson <email@hidden>)
 >Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers? (From: David Duncan <email@hidden>)

  • Prev by Date: Accessing Menu in Another Nib
  • Next by Date: Re: NSOutlineView assertion failures
  • Previous by thread: Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?
  • Next by thread: Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?
  • Index(es):
    • Date
    • Thread