From e9a3e7936fce661f18272b1e58c9e32c81554d56 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sat, 19 May 2007 19:11:54 +0000 Subject: [PATCH] make overlay badge rounded without border --- macosx/DragOverlayView.m | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/macosx/DragOverlayView.m b/macosx/DragOverlayView.m index 093547ea4..f84ae3614 100644 --- a/macosx/DragOverlayView.m +++ b/macosx/DragOverlayView.m @@ -32,17 +32,32 @@ { //create badge NSRect badgeRect = NSMakeRect(0, 0, 325.0, 84.0); - fBackBadge = [[NSImage alloc] initWithSize: badgeRect.size]; [fBackBadge lockFocus]; - [NSBezierPath setDefaultLineWidth: 5.0]; + float minX = NSMinX(badgeRect), + minY = NSMinY(badgeRect), + maxX = NSMaxX(badgeRect), + maxY = NSMaxY(badgeRect), + midX = NSMidX(badgeRect), + midY = NSMidY(badgeRect), + radius = 15.0; + NSBezierPath * bp = [NSBezierPath bezierPath]; + [bp moveToPoint: NSMakePoint(maxX, midY)]; + [bp appendBezierPathWithArcFromPoint: NSMakePoint(maxX, maxY) toPoint: NSMakePoint(midX, maxY) radius: radius]; + [bp appendBezierPathWithArcFromPoint: NSMakePoint(minX, maxY) toPoint: NSMakePoint(minX, midY) radius: radius]; + [bp appendBezierPathWithArcFromPoint: NSMakePoint(minX, minY) toPoint: NSMakePoint(midX, minY) radius: radius]; + [bp appendBezierPathWithArcFromPoint: NSMakePoint(maxX, minY) toPoint: NSMakePoint(maxX, midY) radius: radius]; + [bp closePath]; + + [NSBezierPath setDefaultLineWidth: 20.0]; [[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.75] set]; - [NSBezierPath fillRect: badgeRect]; + [bp fill]; - [[NSColor whiteColor] set]; - [NSBezierPath strokeRect: badgeRect]; + /*[[NSColor whiteColor] set]; + [bp stroke]; + [NSBezierPath strokeLineFromPoint: NSMakePoint(minX, minY + radius) toPoint: NSMakePoint(minX, maxY - radius)];*/ [fBackBadge unlockFocus];