THColorPanel

Here is where the magnanimous folks that create externals post them (.zip archives only please).

THColorPanel

Postby sctell » Thu Mar 31, 2011 10:27 am

I am not sure if this has been done before but if it has perhaps it has a few differences.

THColorPanel is an external that presents a Cocoa NSColorPanel.

It displays the color picker and allows you to select the colour.

When a colour has been selected it sends a message THColorPanelClicked which is used with another function
THColorPanel("color") to obtain the colour (see below).

Code: Select all
on THColorPanelClicked
put THColorPanel("color") into cd fld 1
end THColorPanelClicked


The colour is returned in a particular format a few examples below:

The color space, followed by the color data (including any alpha)


NSCalibratedRGBColorSpace,0.641089,0.497525,0.269802,1.000000

NSCustomColorSpace,0.214008,0.349355,0.724681,0.254950,1.000000 (this is actually cmyk generic)

NSDeviceCMYKColorSpace,0.214008,0.349355,0.724681,0.254950,1.000000

NSCalibratedRGBColorSpace,0.419508,0.427940,0.184900,1.000000 (this is actually HSB)

NSCalibratedWhiteColorSpace,0.269802,1.000000 (gray scale generic)

There are to many options in the color panel to list.

I actually thought this may be useful with the THGraphics external.
Last edited by sctell on Fri Jul 22, 2011 10:57 pm, edited 3 times in total.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: THColorPanel

Postby LorenzT » Fri Apr 01, 2011 5:54 am

Hi Terry

I like this!
May I use it for my grc2coreGrc function?

Lorenz
LorenzT
 
Posts: 176
Joined: Thu Dec 02, 2010 2:32 am
Location: Switzerland

Re: THColorPanel

Postby sctell » Fri Apr 01, 2011 10:10 am

Hi Lorenz,

Use it for anything you want.

Not sure of any issues but "No guarantees".

If you find any issues please post and I will do my best to fix them.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: THColorPanel

Postby mrBean » Sun Apr 03, 2011 7:35 am

I don't know if this is a real problem or not, but when you use the CMYK Sliders the THColorPanel comes back with "NSCustomColorSpace". I thought the feed back for CMYK would look something like this 'NSDeviceCMYKColorSpace'.
User avatar
mrBean
 
Posts: 89
Joined: Sat Jan 30, 2010 8:03 am
Location: New York

Re: THColorPanel

Postby sctell » Sun Apr 03, 2011 10:29 am

mrBean wrote:I don't know if this is a real problem or not, but when you use the CMYK Sliders the THColorPanel comes back with "NSCustomColorSpace". I thought the feed back for CMYK would look something like this 'NSDeviceCMYKColorSpace'.


Hi,

I think you will find it is correct.

When the sliders are selected if you click on the coloured box to the left of the slider a popup menu will display with two choices:

Device CMYK

Generic CMYK

selecting Device CMYK will show NSDeviceCMYKColorSpace in SC

selecting Generic CMYK will show NSCustomColorSpace in SC

I believe this is correct.

If it is not then it appears to be Apple's issue as all I do is:
Code: Select all
NSColor* tColor = [[NSColorPanel sharedColorPanel] color];
NSString* tColorSpaceName = [tColor colorSpaceName];


tColorSpaceName is returned to SC.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: THColorPanel

Postby mrBean » Sun Apr 03, 2011 2:40 pm

sctell wrote:When the sliders are selected if you click on the coloured box to the left of the slider a popup menu will display with two choices:


I was mistaken, i was thinking of this part of the feedback as a simple way to detect if the value is CMYK or RGB. I hadn't realized that this was the color profile info.
User avatar
mrBean
 
Posts: 89
Joined: Sat Jan 30, 2010 8:03 am
Location: New York

Re: THColorPanel

Postby gonetriadrr » Mon Apr 04, 2011 10:29 am

Hi Terry.
Is it possible for messages to be sent to target().
If issued from a palette, messages don't seem to arrive.

BTW: 'custom' color space names appear to be any profile based colorspace.

Thanks,
DCS
gonetriadrr
 
Posts: 170
Joined: Fri Jan 08, 2010 6:50 pm

Re: THColorPanel

Postby Dan_Kelleher » Mon Apr 04, 2011 10:45 am

even if prefaced with
setWindow wd sufficientWindowDescriptor
to direct the message ?
Daniel.Kelleher@umassmed.edu
SC4.7.3 OSX 10.7.2 Mac Pro
User avatar
Dan_Kelleher
 
Posts: 438
Joined: Sun Jul 06, 2008 2:45 pm
Location: Worcester (wouster as in would) Massachusetts USA

Re: THColorPanel

Postby sctell » Tue Apr 12, 2011 5:33 am

gonetriadrr wrote:Is it possible for messages to be sent to target().


I have changed the external so that you can specify where the message is sent.

Here are a few examples:

--get THColorPanel("openColorPanel", "cd btn id 100")
--get THColorPanel("openColorPanel", "this cd")

get THColorPanel("openColorPanel", "this project")

This example sends the message to the project script of whichever project is at the front.

Please note you will get an error if:

on THColorPanelClicked

end THColorPanelClicked

is not present in the project script.

Please note I cannot get

get THColorPanel("openColorPanel", "the target") to work.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: THColorPanel

Postby gonetriadrr » Sat Apr 23, 2011 12:10 pm

Hi Terry,
Just noticed the new version doesn't send a message when the opacity slider is dragged.

DCS
gonetriadrr
 
Posts: 170
Joined: Fri Jan 08, 2010 6:50 pm

Re: THColorPanel

Postby Dan_Kelleher » Sun Apr 24, 2011 6:31 am

It does work as a "preset"; set the opacity, then choose a color.
Daniel.Kelleher@umassmed.edu
SC4.7.3 OSX 10.7.2 Mac Pro
User avatar
Dan_Kelleher
 
Posts: 438
Joined: Sun Jul 06, 2008 2:45 pm
Location: Worcester (wouster as in would) Massachusetts USA

Re: THColorPanel

Postby sctell » Fri Apr 29, 2011 11:08 pm

Hi,

Been away for a short break, hence no reply.

gonetriadrr wrote:Just noticed the new version doesn't send a message when the opacity slider is dragged.


I have just fixed this and it now send the message when the opacity slider is dragged.

The update is in the first message of the thread.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am


Return to XCmds, XFcns, and XRtns

Who is online

Users browsing this forum: No registered users and 1 guest