• 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: NSColor (alpha enabling and setting color in color panel)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSColor (alpha enabling and setting color in color panel)


  • Subject: Re: NSColor (alpha enabling and setting color in color panel)
  • From: Karl Kraft <email@hidden>
  • Date: Thu, 2 Jan 2003 02:02:51 -0600

On Thursday, January 2, 2003, at 01:30 AM, Aaron Boothello wrote:

1)how do i create a colorPanel, and create an outlet for it ?

When the user clicks on the border of the color well, it will take care of creating the color panel, displaying it, and taking the updated color information from it. You will ask the color well for the displayed value, not the panel, so you shouldn't need an instance for the panel.

But if you do need the panel, you can use

NSColorPanel *thePanel = [NSColorPanel sharedColorPanel];


2)and well, the program im writing involves OpenGL, so i have an NSColor object nsColor, and get the RGBA (no alpha yet) values from the colorwell..... so i have the RGBA values, and want to set the color of the well and panel using these RGBA values. is there a way i can do that ?


The well will always want a NSColor objects. The user may pick a color using CYMK, but you will probably always want RGBA for your work. Don't worry what the user picks in.

To make a NSColor from RGBA, use
NSColor *newColor = [NSColor colorWithCalibratedRed:r
green:g
blue:b
alpha:a];

To set the color well

[colorwell setColor:newColor];

When the user is done changing the color, using

newColor = [colorWerll color];

To break it down into the RGBA components:


[newColor getRed:&r
green:&g
blue:&b
alpha:&a]
_______________________________________________
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.

References: 
 >Re: NSColor (alpha enabling and setting color in color panel) (From: Aaron Boothello <email@hidden>)

  • Prev by Date: Re: NSColor (alpha enabling and setting color in color panel)
  • Next by Date: Re: Icon in NSOutlineView
  • Previous by thread: Re: NSColor (alpha enabling and setting color in color panel)
  • Next by thread: Where to learn about designated initializers?
  • Index(es):
    • Date
    • Thread