アットウィキロゴ

CoreTextView.m

 def drawRect(rect)
   set NSColor.whiteColor
   NSBezierPath.fillRect self.bounds
 	
 	// Initialize the text matrix to a known value
 	// テキストマトリックスをアレで初期化
   context = NSGraphicsContext.currentContext.graphicsPort
   CGContextSetTextMatrix(context, CGAffineTransformIdentity)
 
   framesetter = self.framesetter
   clumnPaths = self createColumns
 
   pathCount = columnPaths.count
 
   startIndex = 0
   columnPaths.each_with_index{|path, i|
     frame = [[CTFramesetter]]::CreateFrame(framesetter, CFRange::Make(startIndex,0), path, NULL)
     [[CTFrame]]::Draw(frame, context)
     frameRange = CTFrame::GetVisibleStringRange(frame)
     startIndex += frameRange.length
   }
 end

 - (void)drawRect:(NSRect)rect {
 	// Draw a white background.
 	[[NSColor whiteColor] set];//背景を白に
 	[NSBezierPath fillRect:[self bounds]];//ベジエ曲線 
 	
 	// Initialize the text matrix to a known value
 	// テキストマトリックスをアレで初期化
 	CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
 	CGContextSetTextMatrix(context, CGAffineTransformIdentity);
 	
 	CTFramesetterRef framesetter = [self framesetter];
 	CFArrayRef columnPaths = [self createColumns];//columnPath
 	
 	CFIndex pathCount = CFArrayGetCount(columnPaths);
 	CFIndex startIndex = 0;
 	int column;
 	for (column = 0; column < pathCount; column++) {
 		CGPathRef path = (CGPathRef)CFArrayGetValueAtIndex(columnPaths, column);
 		
 		// Create a frame for this column and draw it.
 		// このカラムのためのフレームを作成し、フレームを描画する
 		CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(startIndex, 0), path, NULL);
 		CTFrameDraw(frame, context);
 		
 		// Start the next frame at the first character not visible in this frame.
 		// 次のフレームを開始する、このフレーム内に表示されていない最初の文字
 		CFRange frameRange = CTFrameGetVisibleStringRange(frame);//フレームに描画された範囲を取得
 		startIndex += frameRange.length;//フレームレンジを加算
 		
 	}
 	
 }

タグ:

+ タグ編集
  • タグ:
最終更新:2010年06月10日 23:10
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。