colorWithColorSpace:components:count:
指定したカラースペースによって作られたNSColorオブジェクトを返します
+(NSColor *)colorWithColorSpace:(NSColorSpace *)space: components:(const CGFloat *)components: count:(NSInteger)numberOfComponents:
解説
指定したカラースペースによって作られたNSColorオブジェクトを返します。
spaceはカラースペースを表現するNSColorSpaceオブジェクトでなければなりません。
コンポーネント配列での
コンポーネントの数は指定したカラースペースにアルファ加えた値です。
合わなければ例外を起こします。
返り値
( NSColor * )
カラーオブジェクト
引数
( NSColorSpace * )space
( const CGFloat * )components
コンポーネントの配列
( NSInteger )numberOfComponents
コンポーネントの数
フレームワーク
ApplicationKit
クラス
NSColor
Class Methods
使用可能
10.4
参照
-colorUsingColorSpace:
例文
#import "Controller.h" @implementation Controller - (IBAction)myAction:(id)sender { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 CGFloat components[4]; components[0] = 1.0; components[1] = 1.0; components[2] = 0.5; components[3] = 1.0; NSColor *theColor = [NSColor colorWithColorSpace:[NSColorSpace deviceRGBColorSpace] components:components count:4];//カラー作成 NSLog(@"--- %@",[theColor description]); NSLog(@"--- %@",[theColor colorSpace]); [name setStringValue:@"CMYKcolor"];//outlet nameに文字をセット [name setTextColor:theColor];//outlet name(text field)の文字色をtheColorにする #endif } @end