macOS/iOS API解説

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

目次

transformStruct

Index>Foundation>NSAffineTransform

レシーバーのマトリックスに変換マトリックスの行列式を返します

解説

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

返り値

( NSAffineTransformStruct )

変換マトリックス

引数

クラス

NSAffineTransform

Instance Methods

使用可能

10.0

参照

- initWithTransform:
- setTransformStruct:

例文

#import "MyView.h"

@implementation MyView

//NSViewのサブクラス MyViewのDrawRectに上書き
-(void)drawRect:(NSRect)rect
{

NSBezierPath *thePath1 = [NSBezierPath bezierPath];
NSAffineTransform *affin = [NSAffineTransform transform];
NSAffineTransformStruct ts;
[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 scaleBy:1.5];
ts = [affin transformStruct];
NSLog([NSString stringWithFormat:@"m11=%.1f,m12=%.1f,m21=%.1f,m22=%.1f,tx=%.1f,ty=%.1f",ts.m11,ts.m12,ts.m21,ts.m22,ts.tX,ts.tY]);

[thePath1 transformUsingAffineTransform: affin];

[[NSColor redColor] set];
[thePath1 fill];




}

@end