David Duncan <email@hidden> writes:
> On Oct 24, 2006, at 3:12 PM, email@hidden wrote:
>
>> I use ClipCGContextToRegion to effectively reset the clip area of a
>> CGContext. In theory this could be achieved by saving the graphics state
>> intersecting some with the clipping area (ie CGContextClipRect), and
>> then restoring. In this case it doesn't work to do this because other
>> things may be in the state that are hard to play back (ie fills etc)
>> after the restore.
>
> I'm wondering what effect you are trying to achieve here. The base
> clip (the one that you get from default when you first get your
> context from whatever source you get it) is the maximal area that you
> can draw to. So saving and restoring the graphics state is the right
> thing to do if you want to reset the clipping area.
>
In this case this is a library that has existed before CoreGraphics and the
intersect (ie reduction only) clipping policy. In the toolkit in question
one can set an arbitrary clip region, which will still be hard clipped to
the maximal painting area (ie an intersection) but a secondary call to the
"set clip" function will again only intersect with the maximal painting
area (ie the region requested in kEventControlDraw) and not the previously
set region.
> Now, if you have a complex series of clips that you want to do, then
> you may need to reorder your code to take maximal advantage of the
> state save to avoid doing duplicate work. Alternatively you can
> create a CGPath and then use that path to clip to later. This will
> allow you to setup complex clipping paths, store them, and then reuse
> them. (you could use CGContextAddPath() then CGContextClip() to
> restore a CGPath as your current clipping path).
I agree in an application one can structure their code to use the cg gstate
efficiently, however from our toolkit this isn't a viable
option. Presumably since CGContextClipRect existed and seemed to function
as I had hoped in the past (I would use CGContextClip to clip to a large
rectangle and then intersect that with the requested region), is there any
hope that such a function can be introduced to clear out the clip of a
context?
Regards
//Sam
> --
> David Duncan
> Developer Technical Support WWDR
> email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden