CGContextEOFillPath not working .. ?
CGContextEOFillPath not working .. ?
- Subject: CGContextEOFillPath not working .. ?
- From: Gustavo Pizano <email@hidden>
- Date: Mon, 22 Feb 2010 22:53:09 +0100
Hello all.
I want to be able to fill the area between 2 rects that Im building as following:
-(void)createPath:(CGContextRef)ctx withInnerRect:(NSRect) rect{
NSRect outterFrame = [self bounds];
CGContextBeginPath(ctx);
//Outtter Line
CGContextMoveToPoint(ctx, NSMidX(outterFrame), NSMinY(outterFrame));
CGContextAddArcToPoint(ctx,
NSMaxX(outterFrame), NSMinY(outterFrame), NSMaxX(outterFrame), NSMidY(outterFrame), 5.0f);
CGContextAddArcToPoint(ctx,
NSMaxX(outterFrame), NSMaxY(outterFrame), NSMidX(outterFrame), NSMaxY(outterFrame),5.0f);
CGContextAddArcToPoint(ctx,
NSMinX(outterFrame), NSMaxY(outterFrame), NSMinX(outterFrame), NSMidY(outterFrame), 5.0f);
CGContextAddArcToPoint(ctx,
NSMinX(outterFrame), NSMinY(outterFrame), NSMidX(outterFrame), NSMinY(outterFrame), 5.0f); //???#1
CGContextAddLineToPoint(ctx, NSMidX(outterFrame), NSMinY(outterFrame));
//Inner Line
CGContextMoveToPoint(ctx, NSMidX(rect), NSMinY(rect));
CGContextAddArcToPoint(ctx,
NSMaxX(rect), NSMinY(rect), NSMaxX(rect), NSMidY(rect), 5.0f);
CGContextAddArcToPoint(ctx,
NSMaxX(rect), NSMaxY(rect), NSMidX(rect), NSMaxY(rect),5.0f);
CGContextAddArcToPoint(ctx,
NSMinX(rect), NSMaxY(rect), NSMinX(rect), NSMidY(rect), 5.0f);
CGContextAddArcToPoint(ctx,
NSMinX(rect), NSMinY(rect), NSMidX(rect), NSMinY(rect), 5.0f); //???#2
CGContextAddLineToPoint(ctx, NSMidX(rect), NSMinY(rect));
CGContextSetLineWidth(ctx, 3.0f);
CGContextSetStrokeColorWithColor(ctx, CGColorCreateGenericRGB(0.5f, 0.5f, 0.5f, 0.7f));
CGContextStrokePath(ctx);
CGContextClosePath(ctx);
CGContextEOFillPath(ctx);
}
Sot both rounded rects are being display, dont ask me but for some reason the lines didn't want to go to the end on the lines //???#1 and //???#2, and I had to add an CGContextAddLineToPoint, to where the line started. Anyway, I want to fill the are between these 2 rect with the set color, I thought calling the CGContextEOFillPath will just do it, but it seems Im missing something, I was reading the docs but they don't say much about it, just show these images of concentric circles and using the fill methods and thats it.
Any ideas what am I missing in order to achieve the goal.?
Thanks
Gustavo
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden