setLineDash:count:phase:
ラインのパターン(点線など)をセットします
- (void)setLineDash:(const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase
func setLineDash(_ pattern: UnsafePointer<CGFloat>, count count: Int, phase phase: CGFloat)
解説
ラインのパターン(点線など)をセットします。
patternはfloatの配列で、塗り・空き・塗り・空き...を繰り返します。
countは上記の要素数で、「塗り・空き」なら2となる。
phaseはパターンを開始するポイント。
返り値
なし
引数
塗り、空きの配列
Objective-C(const CGFloat *)pattern
pattern: UnsafePointer<CGFloat>
( const float * )pattern
塗り、空きの配列の要素数
Objective-Ccount:(NSInteger)countcount count: Int,
書き始め(ポイント)
Objective-Cphase:(CGFloat)phasephase phase: CGFloat)
フレームワーク
ApplicationKit
クラス
NSBezierPath
使用可能
10.0
参照
- getLineDash:count:phase:
関連記事(外部サイト)
例文
#import "MyView.h" @implementation MyView //NSViewのサブクラス MyViewのDrawRectに上書き -(void)drawRect:(NSRect)rect { float array[5]; NSBezierPath *thePath = [NSBezierPath bezierPath]; [NSBezierPath setDefaultLineJoinStyle:NSBevelLineJoinStyle]; [thePath moveToPoint:NSMakePoint(20,20)]; [thePath lineToPoint:NSMakePoint(120,120)]; [thePath lineToPoint:NSMakePoint(40,20)]; [thePath appendBezierPathWithRect:NSMakeRect(50,50,100,100)]; [thePath setFlatness:0.5]; [thePath setLineWidth:5]; [[NSColor redColor] set]; array[0] = 8.0; //塗る array[1] = 3.0; //塗らない array[2] = 20.0; //塗る array[3] = 3.0; //塗らない [thePath setLineDash: array count: 4 phase: 0.0]; [thePath stroke]; //NSLog([NSString stringWithFormat:@"%.1f",[thePath flatness]]); } @end
更新時のバージョン
OS X 10.10