public override Id InitWithFrame(NSRect frame) { Id self = ObjectiveCRuntime.SendMessageSuper<Id>(this, Class.Get(typeof (TLayerView)), "initWithFrame:", frame); if (self == null) { return null; } this.useTLayer = false; this.circles = new NSMutableArray(CIRCLE_COUNT); for (int k = 0; k < CIRCLE_COUNT; k++) { NSColor color = NSColor.ColorWithCalibratedRedGreenBlueAlpha(colors[k][0], colors[k][1], colors[k][2], colors[k][3]); Circle circle = new Circle(); circle.Color = color; circle.Radius = circleRadius; circle.Center = MakeRandomPointInRect(this.Bounds); this.circles.AddObject(circle); circle.Release(); } this.RegisterForDraggedTypes(NSArray.ArrayWithObject(NSPasteboard.NSColorPboardType)); this.NeedsDisplay = true; return self; }
public NSRect BoundsForCircle(Circle circle) { float dx = 2*Math.Abs(this.shadowOffset.width) + 2*this.shadowRadius; float dy = 2*Math.Abs(this.shadowOffset.height) + 2*this.shadowRadius; return NSRect.NSInsetRect(circle.Bounds, -dx, -dy); }