getColor:location:atIndex:
グラデーションオブジェクトに設定されているカラーから指定した番号のカラーを取り出します
-(void)getColor:(NSColor **)color: location:(CGFloat *)location: atIndex:(NSInteger)index:
解説
グラデーションオブジェクトに設定されているカラーから指定した番号のカラーを取り出します。
返り値
( void )
なし
引数
( NSColor ** )color
indexで指定した番号のカラーが返される
( CGFloat * )location
0.0から1.0の範囲でどの位置にあるかが返される
( NSInteger )index
何番目のカラーを取り出すかの番号を指定する
フレームワーク
ApplicationKit
クラス
NSGradient
使用可能
10.5
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSColor *theColor; CGFloat theFloat; NSGradient *gradient = [[NSGradient alloc] initWithColors: [NSArray arrayWithObjects: [NSColor redColor], [NSColor greenColor], nil ] ]; [theView lockFocus]; [gradient drawInRect: NSMakeRect(0,0,100,100) angle: (CGFloat)30.0 ]; [theView unlockFocus]; [gradient getColor: &theColor location: &theFloat atIndex: (NSInteger)1 ]; NSLog(@"theColor %@ ,location %f",[theColor description],theFloat); } @end