macOS/iOS API解説

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

目次

drawInBezierPath:relativeCenterPosition:

指定したベジェパスを円グラデーションで塗って描画します
-(void)drawInBezierPath:(NSBezierPath *)path:
                 relativeCenterPosition:(NSPoint)relativeCenterPosition:

解説

指定したベジェパスを円グラデーションで塗って描画します。

返り値

( void )

なし

引数

( NSBezierPath * )path

描画するベジエパス

( NSPoint )relativeCenterPosition

関連する円の中心点

フレームワーク

ApplicationKit

クラス

NSGradient

使用可能

10.5

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{

	NSBezierPath *thePath = [NSBezierPath bezierPath];
	[thePath moveToPoint:NSMakePoint(20,20)];

	[thePath appendBezierPathWithOvalInRect:NSMakeRect(50,50,100,100)];
	[thePath appendBezierPathWithOvalInRect:NSMakeRect(20,20,80,80)];



	NSGradient *gradient = [[NSGradient alloc] initWithColors:
								[NSArray arrayWithObjects:
										[NSColor redColor],
										[NSColor greenColor],
										nil
										]
								];
	[theView lockFocus];
	
	[gradient drawInBezierPath:	thePath
				relativeCenterPosition:	NSMakePoint(0,1)
				];


	[theView unlockFocus];
}

@end