On 29 Oct, 2012, at 11:43 PM, Ken Thomases <k...@codeweavers.com> wrote:

> On Oct 29, 2012, at 8:22 AM, Roland King wrote:
> 
>> I have a graphics context and a path and I want to clip everything inside 
>> the path, ie not display it, and leave everything outside the path 
>> displayed. The path is simple and doesn't cross itself, for sake of example 
>> it may as well be a circle. If I start with a clip-free GC and set that 
>> circle as a clipping path, I'll get the opposite, everything in the circle 
>> will show, how do I do the other way around? Does it work if I set a path at 
>> the bound rect of the GC plus my shape in the middle? That would seem to 
>> have two crossings to get into the shape, one at the bounds of the rect, one 
>> as you cross the shape, which should mean everything inside the shape is 
>> 'outside' but does a path at the very extremities of the GC, or even outside 
>> it, count as 'crossed'? 
> 
> Yes, that's the correct way.  A clip path is geometric.  It doesn't matter 
> what the bounds of the GC are.  Obviously, only pixels inside the GC bounds 
> can possibly be painted, but the determination of what's clipped or not is 
> determined using the clipping path as a mathematical construct.
> 
> You don't need to use the exact bounds of the GC.  You can use an outer path 
> that's larger than the GC bounds.  Although, I'm not sure if constructing one 
> from CGRectInfinite is wise, you can probably use origin -30,000,-30,000 size 
> 60,000x60,000 or something.
> 
> Regards,
> Ken
> 

Perfect, thanks. That's how I thought it should work, I haven't made it work 
yet so somewhere I've messed up, let me strip it down and go back to a simpler 
project to find the error. 

_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to