macOS/iOS API解説

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

目次

transformPoint:

Index>Foundation>NSAffineTransform

位置をレシーバの変換マトリックスで座標変換して新しい位置を返します
-(NSPoint)transformPoint:(NSPoint)aPoint:

解説

位置(aPoint)をレシーバの変換マトリックスで座標変換して新しい位置を返します。
(NSAffineTransformクラス、10.3までのAppKitから10.4からFoundationに変更)

返り値

( NSPoint )

変換後の位置

引数

( NSPoint )aPoint

変換前の位置

クラス

NSAffineTransform

Instance Methods

使用可能

10.0

参照

- transformBezierPath:
- transformSize:

例文

#import "MyView.h"

@implementation MyView

//NSViewのサブクラス MyViewのDrawRectに上書き
-(void)drawRect:(NSRect)rect
{
	NSPoint po ;
	NSAffineTransform *affin = [NSAffineTransform transform];

	[affin translateXBy: 10.0 yBy: 10.0];

	po = [affin transformPoint: NSMakePoint(20,20)];

	NSLog([NSString stringWithFormat:@"x:%.1f y:%.1f",po.x,po.y]);

}

@end