| Home 目次>ApplicationKit>NSGradient | 10.5 |
interpolatedColorAtLocation:
グラデーションオブジェクトの指定した場所のカラーを返します
-(NSColor *) interpolatedColorAtLocation:(CGFloat)location
【返り値】 | |
| NSColor * | カラーオブジェクト |
| 【パラメータ】 | |
| location | 調べる場所(0.0-1.0) |
【解説】
グラデーションオブジェクトの指定した場所のカラーを返します。
【例文】
#import "MyObject.h"
@implementation MyObject
- (IBAction)myAction:(id)sender
{
NSGradient *gradient = [[NSGradient alloc] initWithColors:
[NSArray arrayWithObjects:
[NSColor redColor],
[NSColor greenColor],
[NSColor blueColor],
nil
]
];
[theView lockFocus];
[gradient drawInRect: NSMakeRect(0,0,100,100)
angle: (CGFloat)30.0
];
[theView unlockFocus];
NSLog([[gradient interpolatedColorAtLocation:0.3] description]);
}
@end
![]() | |
この記事を評価してください。
| Home 目次>ApplicationKit>NSGradient | 修正日2006.12.26 |