makeImageSnapshot after saveLayer

83 views
Skip to first unread message

yufei wen

unread,
Oct 29, 2022, 11:14:49 AM10/29/22
to skia-discuss

Thank you for taking the time to pay attention to this issue.

SkSurface::makeImageSnapshot can create a snapshot of a layer. SkCanvas::saveLayer  creates a new layer for rendering. As shown in the link makeImageSnapshot after saveLayermakeImageSnapshot get the content of the original layer after saveLayer. 

What should I do if I want to get the content of the current layer after saveLayer?

Brian Salomon

unread,
Oct 31, 2022, 10:26:45 AM10/31/22
to skia-d...@googlegroups.com
We don't really have a good way to do that at present. Instead of making a new layer with saveLayer() you could make a new surface with SkCanvas::makeSurface() and then once you draw to that surface call makeImageSnapshot() on the second surface. The main disadvantage is that you lose automatic bounds computation for the second surface based on the starting canvas's clip state and the second surface doesn't inherit the matrix state from the original surface.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/7642d230-28de-4b26-9002-455f4e62ebf0n%40googlegroups.com.


--

Brian Salomon | Office Hours: go/bsalomon-office | bsal...@google.com
Reply all
Reply to author
Forward
0 new messages