--
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/62d42ce8-bfc8-411a-94c1-7a099224fb16%40googlegroups.com.
Skia does not provide an exact API for this sort of thing.However, if you record an SkPicture of all your content, and when recording pass an SkRTreeFactory to beginRecording(), after you call endRecording() the cull rectangle you passed in will be trimmed down to approximate, conservative bounds of the draws you have made. You can retrieve that possibly-smaller rectangle with SkPicture::cullRect(). These bounds may change at any time as we improve Skia; they're only guaranteed to be a bounds, not _the_ bounds.
On Mon, Feb 3, 2020 at 5:35 AM Bruno <bruno...@gmail.com> wrote:
Is it possible to get the exact bounds of what was drawn in a canvas?--For example, I have:auto surface = SkSurface::MakeRasterN32Premul(1000, 1000);auto canvas = surface->getCanvas();and then I have calls like canvas->scale(a, b), canvas->translate(c, d), bitmap drawings etc... So, all kinds of drawings.What I need to do is a basically get the bounds of what was drawn so I can draw a frame around it and save a cropped version to a png file, where the dimensions will be exactly what it needs to be. I don't want to save a 1000x1000 image with just 20x20 drawn for example.Is it possible?Thanks!
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-d...@googlegroups.com.
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/2b5e9b6f-474c-4486-aec2-5491d701ff70%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/2b5e9b6f-474c-4486-aec2-5491d701ff70%40googlegroups.com.
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/c9270824-be48-4602-9d1d-1ca3076f78b1%40googlegroups.com.