macOS/iOS API解説

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

目次

drawFromCenter:radius:toCenter:radius:options:

円から円のグラデーションを描画します
-(void)drawFromCenter:(NSPoint)startCenter:
          radius:(CGFloat)startRadius:
          toCenter:(NSPoint)endCenter:
          radius:(CGFloat)endRadius:
          options:(NSGradientDrawingOptions)options:

解説

円から円のグラデーションを描画します。

返り値

( void )

なし

引数

( NSPoint )startCenter

開始円の中心点

( CGFloat )startRadius

開始円の半径

( NSPoint )endCenter

終了円の中心点

( CGFloat )endRadius

終了円の半径

( 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 drawFromCenter:NSMakePoint(100,100)
		radius:(CGFloat)10.5 
		toCenter:NSMakePoint(80,80)
		radius: (CGFloat)80.3
		options:	NSGradientDrawsBeforeStartingLocation
		];
	//   NSGradientDrawsBeforeStartingLocation =   (1 << 0),
	//	NSGradientDrawsAfterEndingLocation =    (1 << 1),

	[theView unlockFocus];
}

@end