scaleBy:
Index>Foundation>NSAffineTransform
原点を中心に座標の拡大縮小をセットします
-(void)scaleBy:(float)scale:
解説
原点を中心に座標の拡大縮小をセットします。
scale 倍率
(NSAffineTransformクラス、10.3までのAppKitから10.4からFoundationに変更)
返り値
( void )
なし
引数
( float )scale
倍率(1.0が等倍)
フレームワーク
Foundation
クラス
NSAffineTransform
Instance Methods
使用可能
10.0
参照
- rotateByDegrees:
- rotateByRadians:
- scaleXBy:yBy:
- translateXBy:yBy:
例文
#pragma mark -scaleBy: - (IBAction)method005:(id)sender { //make bezier path NSBezierPath *thePath1 = [NSBezierPath bezierPath]; //make affin transform NSAffineTransform *affin = [NSAffineTransform transform]; //focus window's view [_window.contentView lockFocus]; //clear window NSRect rect = [_window.contentView frame ]; [[NSColor windowBackgroundColor] set]; NSRectFill(rect); //set winding rule [thePath1 setWindingRule:NSEvenOddWindingRule]; //move pen [thePath1 moveToPoint:NSMakePoint(20,20)]; //make path [thePath1 appendBezierPathWithOvalInRect:NSMakeRect(50,50,100,100)]; [thePath1 appendBezierPathWithOvalInRect:NSMakeRect(20,20,80,80)]; //set color [[NSColor blueColor] set]; //fill path [thePath1 fill]; //set transform [affin scaleBy:1.5]; [thePath1 transformUsingAffineTransform: affin]; //set color [[NSColor redColor] set]; [thePath1 fill]; //unlock focus [_window.contentView unlockFocus]; [_window.contentView displayIfNeeded]; }
#import "MyView.h" @implementation MyView -(void)drawRect:(NSRect)rect { NSBezierPath *thePath1 = [NSBezierPath bezierPath]; NSAffineTransform *affin = [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 scaleBy:1.5]; [thePath1 transformUsingAffineTransform: affin]; [[NSColor redColor] set]; [thePath1 fill]; } @end