macOS/iOS API解説

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

目次

appendTransform:

Index>Foundation>NSAffineTransform

変換マトリックスに別の変換マトリックスを加えて、その結果を返します
-(void)appendTransform:(NSAffineTransform *)aTransform:

解説

変換マトリックスに別の変換マトリックス(aTransform)を加えて、その結果を返します。(NSAffineTransformクラス、10.3までのAppKitから10.4からFoundationに変更)

返り値

( void )

なし

引数

( NSAffineTransform * )aTransform

後に付加する変換マトリックス

クラス

NSAffineTransform

Instance Methods

使用可能

10.0

参照

- prependTransform:

例文

#import "MyView.h"

@implementation MyView

//NSViewのサブクラス MyViewのDrawRectに上書き
-(void)drawRect:(NSRect)rect
{
	//ベジエパス作る
	NSBezierPath *thePath1 = [NSBezierPath bezierPath];
	//アフィン変換作る
	NSAffineTransform *affin = [NSAffineTransform transform];
	NSAffineTransform *affin2 = [NSAffineTransform transform];
	//くりぬき規則
	[thePath1 setWindingRule:NSEvenOddWindingRule];
	//移動
	[thePath1 moveToPoint:NSMakePoint(20,20)];
	//楕円書く
	[thePath1 appendBezierPathWithOvalInRect:NSMakeRect(50,50,100,100)];
	[thePath1 appendBezierPathWithOvalInRect:NSMakeRect(20,20,80,80)];
	//ブルー
	[[NSColor blueColor] set];
	[thePath1 fill];
	//移動して
	[affin translateXBy: 10.0 yBy: 10.0];
	[affin2 translateXBy: 10.0 yBy: 10.0];
	[affin appendTransform:affin2];
	[thePath1 transformUsingAffineTransform: affin];
	//赤で書く
	[[NSColor redColor] set];
	[thePath1 fill];
	
}

@end