macOS/iOS API解説

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

目次

setTransformStruct:

Index>Foundation>NSAffineTransform

aTransformStructでレシーバーの変換マトリックスをセットする
-(void)setTransformStruct:(NSAffineTransformStruct)aTransformStruct:

解説

レシーバの変換マトリックスのNSAffineTransformStructをセットします。
【NSAffineTransformStruct】
{m11、m12、m21、m22、tX、tY}で表される変換マトリックスの行列式
(NSAffineTransformクラス、10.3までのAppKitから10.4からFoundationに変更)

返り値

( void )

なし

引数

( NSAffineTransformStruct )aTransformStruct

変換マトリックス

クラス

NSAffineTransform

Instance Methods

使用可能

10.0

参照

- initWithTransform:
- transformStruct

例文

#import "MyView.h"

@implementation MyView

//NSViewのサブクラス MyViewのDrawRectに上書き
-(void)drawRect:(NSRect)rect
{
	
	NSBezierPath *thePath1 = [NSBezierPath bezierPath];
	NSAffineTransform *affin = [NSAffineTransform transform];
	NSAffineTransformStruct ts = {1.5,0.0,0.0,1.5,0.0,0.0};
	[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 setTransformStruct:ts];
	
	
	[thePath1 transformUsingAffineTransform: affin];
	
	[[NSColor redColor] set];
	[thePath1 fill];

}

@end