0
變化。當我畫這個對象是一個時代的作品,但在那之後我的路徑對象(女巫NSBezierPath)在NSCFTimer對象的變化。我NSBezierPath在NSCFTimer
- (void)draw {
NSRect drawingbounds = [self drawingbounds];
if(image == nil) {
image = [[NSImage alloc] initWithSize:drawingbounds.size];
[image lockFocus];
NSAffineTransform *transform = [NSAffineTransform transform];
[transform translateXBy:-drawingbounds.origin.x yBy:-drawingbounds.origin.y];
[transform concat];
[[NSColor redColor] set];
[path stroke];
[image unlockFocus];
[image retain];
}
[image drawAtPoint:NSMakePoint(10.0, 10.0)
fromRect: NSMakeRect(0.0, 0.0, 100.0, 100.0)
operation: NSCompositeSourceOver
fraction: 1.0];
}
- (NSRect)drawingbounds {
NSLog([path description]);
return NSMakeRect(10.0, 10.0, 100.0, 100.0);
return NSInsetRect([path bounds], -[path lineWidth] , -[path lineWidth]);
}
糟糕的代碼元素沒有工作,對不起 – kaibakker 2011-02-12 11:27:39