How to get current clip region?

36 views
Skip to first unread message

Jim Shi

unread,
Mar 5, 2018, 10:32:41 PM3/5/18
to skia-discuss
Hi, 

Just want to get current clip region from a canvas, anyone can shed a light on how to do it?

cheers,
Jim

Cary Clark

unread,
Mar 6, 2018, 8:13:32 AM3/6/18
to skia-d...@googlegroups.com
The current clip region is not exposed.

What is your use case? Perhaps there's another way to achieve your end result.

Cary


--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Jim Shi

unread,
Mar 7, 2018, 8:13:35 PM3/7/18
to skia-discuss
thanks Cary.

actually my use case is to save current clip, then set to some new clips, later i want restore the old clip. all these clips are global coords and should be trans matrix independent.

could you help advise the proper way to do so? 

Cheers,
Jim

On Wednesday, 7 March 2018 00:13:32 UTC+11, Cary Clark wrote:
The current clip region is not exposed.

What is your use case? Perhaps there's another way to achieve your end result.

Cary

On Mon, Mar 5, 2018 at 10:32 PM, Jim Shi <jim....@gmail.com> wrote:
Hi, 

Just want to get current clip region from a canvas, anyone can shed a light on how to do it?

cheers,
Jim

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.

Yuqian Li

unread,
Mar 8, 2018, 9:45:46 AM3/8/18
to skia-d...@googlegroups.com
I think canvas.save and canvas.restore are what you want. For example: https://fiddle.skia.org/c/def2ce5df1c8d7aac47c73534ad32c80

To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.

Mike Reed

unread,
Mar 8, 2018, 10:11:55 AM3/8/18
to skia-d...@googlegroups.com
Skia does not support replacing the current clip. The only call that sorta used to do that, clipRegion(), is going away now.

I think you may need to do something like:

save
concat(inverse_of_ctm_to_create_identity)
clipPath(your_global_clip)
...
restore


To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages