• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Bezier Path Arc Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bezier Path Arc Problem


  • Subject: Bezier Path Arc Problem
  • From: "John Cassington" <email@hidden>
  • Date: Wed, 4 Oct 2006 06:25:27 +1000

Hi, the image shows the problem

http://img522.imageshack.us/img522/6435/picture2ss3.png

here is the code:

- (void)drawRect:(NSRect)rect
{
   NSColor *bgColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.1];
   NSRect bgRect = rect;
   int minX = NSMinX(bgRect);
   int midX = NSMidX(bgRect);
   int maxX = NSMaxX(bgRect);
   int minY = NSMinY(bgRect);
   int midY = NSMidY(bgRect);
   int maxY = NSMaxY(bgRect);
   float radius = 25.0; // correct value to duplicate Panther's App Switcher
   NSBezierPath *bgPath = [NSBezierPath bezierPath];

   // Bottom edge and bottom-right curve
   [bgPath moveToPoint:NSMakePoint(midX, minY)];
   [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(maxX, minY)
                                    toPoint:NSMakePoint(maxX, midY)
                                     radius:radius];

   // Right edge and top-right curve
   [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(maxX, maxY)
                                    toPoint:NSMakePoint(midX, maxY)
                                     radius:radius];

   // Top edge and top-left curve
   [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(minX, maxY)
                                    toPoint:NSMakePoint(minX, midY)
                                     radius:radius];

   // Left edge and bottom-left curve
   [bgPath appendBezierPathWithArcFromPoint:bgRect.origin
                                    toPoint:NSMakePoint(midX, minY)
                                     radius:radius];
   [bgPath closePath];

   [bgColor set];
   [bgPath fill];

	[bgPath setLineWidth:10.0];
	[[NSColor colorWithCalibratedWhite:0.75 alpha:0.3] set];
	[bgPath stroke];
}

as you can see, the path i want is being stroked but around curves
there is an added squareness?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Bezier Path Arc Problem
      • From: "Stephen Deken" <email@hidden>
  • Prev by Date: NSCell editing weirdness
  • Next by Date: Re: Bezier Path Arc Problem
  • Previous by thread: Re: NSCell editing weirdness
  • Next by thread: Re: Bezier Path Arc Problem
  • Index(es):
    • Date
    • Thread