Re: CGContextEOFillPath not working .. ? [Solved]
Ok it works, this is what I did: CGContextBeginPath(ctx); ... /.//create the outter ... CGContextClosePath(ctx); ... ... //Create the inner path CGContextClosePath(ctx); CGContextSetFillColorWithColor(ctx, CGColorCreateGenericRGB(0.5f, 0.5f, 0.5f, 0.5f)); CGContextEOFillPath(ctx); //Recreate the inner path to be stroke.. CGContextBeginPath(ctx); .. .. //Inner path again CGContextClosePath(ctx); CGContextSetLineWidth(ctx, 3.0f); CGContextSetStrokeColorWithColor(ctx, CGColorCreateGenericRGB(0.0f, 0.0f, 0.0f, 0.5f)); CGContextStrokePath(ctx); Ok the colors Im creating I have modified to create the colors then use them and then release them, otherwise I will have leaks. I will read again the Qartz PG, because I don't get the behavior of these paths Thanks Gustavo On Feb 23, 2010, at 12:36 AM, David Duncan wrote: > On Feb 22, 2010, at 1:53 PM, Gustavo Pizano wrote: > >> Hello all. >> >> I want to be able to fill the area between 2 rects that Im building as >> following: >> >> 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.? > > > You have one open and one closed path here. Try adding a CGContextClosePath > call after you've specified the first round rect (instead of your > CGContextAddLineToPoint call). > -- > David Duncan > Apple DTS Animation and Printing > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CGContextEOFillPath not working .. ?
Hello David.. Ok I added the CGContextClosePath instead of the CGContextAddLine of the first rect, and the path closes, but the internal doesn't, so I remove the CGContextAddLine of the second rect and place the CGContextClosePath I had at the bottom instead, and both rects close great. I then defined this: ... CGContextClosePath(ctx); //close path of the second rect CGContextSetLineWidth(ctx, 3.0f); CGContextSetStrokeColorWithColor(ctx, CGColorCreateGenericRGB(0.5f, 0.5f, 0.5f, 0.7f)); CGContextStrokePath(ctx); CGContextSetFillColorWithColor(ctx, CGColorCreateGenericRGB(0.5f, 0.5f, 0.5f, 0.5f)); CGContextEOFillPath(ctx); but the area between the rects its not being filled, which is what I want to achieve, something similar to when the user selects a profile picture for the account, Im moving a slider and the internal rect its being resized, but no fill color... ? Thx Gustavo On Feb 23, 2010, at 12:36 AM, David Duncan wrote: > On Feb 22, 2010, at 1:53 PM, Gustavo Pizano wrote: > >> Hello all. >> >> I want to be able to fill the area between 2 rects that Im building as >> following: >> >> 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.? > > > You have one open and one closed path here. Try adding a CGContextClosePath > call after you've specified the first round rect (instead of your > CGContextAddLineToPoint call). > -- > David Duncan > Apple DTS Animation and Printing > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CGContextEOFillPath not working .. ?
On Feb 22, 2010, at 1:53 PM, Gustavo Pizano wrote: > Hello all. > > I want to be able to fill the area between 2 rects that Im building as > following: > > 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.? You have one open and one closed path here. Try adding a CGContextClosePath call after you've specified the first round rect (instead of your CGContextAddLineToPoint call). -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com