getLineDash:count:phase:
ラインのパターンを返します
- (void)getLineDash:(CGFloat *)pattern count:(NSInteger *)count phase:(CGFloat *)phasefunc getLineDash(_ pattern: UnsafeMutablePointer<CGFloat>, count count: UnsafeMutablePointer<Int>, phase phase: UnsafeMutablePointer<CGFloat>)
解説
ラインのパターンを返します
patternにfloatの配列
countはパターンの要素数。
phaseは開始するポイント。
にそれぞれの値を入れる。
フレームワーク
ApplicationKit
クラス
NSBezierPath
使用可能
10.0
関連記事(外部サイト)
例文
#import "MyView.h" @implementation MyView //NSViewのサブクラス MyViewのDrawRectに上書き -(void)drawRect:(NSRect)rect { float array[4]; float retArray[4]; float retPhase; int retCount; 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 getLineDash:retArray count:&retCount phase:&retPhase]; [thePath stroke]; NSLog([NSString stringWithFormat:@"array'%.1f,%.1f,%.1f,%.1f' count %d phase %.1f",retArray[0],retArray[1],retArray[2],retArray[3],retCount,retPhase]); } @end
更新時バージョン
10.10