macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

drawFromPoint:toPoint:options:

指定した点から点までの帯状のグラデーションを返します
-(void)drawFromPoint:(NSPoint)startingPoint:
          toPoint:(NSPoint)endingPoint:
          options:(NSGradientDrawingOptions)options:

解説

指定した点から点までの帯状のグラデーションを返します。

返り値

( void )

なし

引数

( NSPoint )startingPoint
( NSPoint )endingPoint
( NSGradientDrawingOptions )options

フレームワーク

ApplicationKit

クラス

NSGradient

使用可能

10.5

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{

	NSGradient *gradient = [[NSGradient alloc] initWithColors:
								[NSArray arrayWithObjects:
										[NSColor redColor],
										[NSColor greenColor],
										nil
										]
								];
	[theView lockFocus];
	
	[gradient drawFromPoint:	NSMakePoint(100,100)
				toPoint:		NSMakePoint(0,50)
				options:		NSGradientDrawsBeforeStartingLocation
				];
	
	//   NSGradientDrawsBeforeStartingLocation =   (1 << 0),
	//	NSGradientDrawsAfterEndingLocation =    (1 << 1),

	[theView unlockFocus];
}

@end