Use a SkCanvas or SkSurface as a shader

123 views
Skip to first unread message

BenP

unread,
Oct 23, 2019, 2:16:43 PM10/23/19
to skia-discuss
Is there a GPU-friendly equivalent of SkBitmap->makeShader(), so I can use an SkCanvas or its SkSurface as a shader? 






Brian Salomon

unread,
Oct 23, 2019, 2:20:16 PM10/23/19
to skia-d...@googlegroups.com
SkImage::MakeFromBitmap(bitmap)->makeTextureImage(<grcontext>)->makeShader();

On Wed, Oct 23, 2019 at 2:16 PM BenP <ben....@gmail.com> wrote:
Is there a GPU-friendly equivalent of SkBitmap->makeShader(), so I can use an SkCanvas or its SkSurface as a shader? 






--
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/74500bd2-f7bd-4493-8683-d6d082cece31%40googlegroups.com.

BenP

unread,
Oct 23, 2019, 2:34:45 PM10/23/19
to skia-discuss
Thanks Brian... 

There is no bitmap. I've drawn to an SkSurface/SkCanvas, and now wish to use that as a shader. I'd like to avoid the CPU. 

B. 


On Wednesday, October 23, 2019 at 7:20:16 PM UTC+1, Brian Salomon wrote:
SkImage::MakeFromBitmap(bitmap)->makeTextureImage(<grcontext>)->makeShader();

On Wed, Oct 23, 2019 at 2:16 PM BenP <ben...@gmail.com> wrote:
Is there a GPU-friendly equivalent of SkBitmap->makeShader(), so I can use an SkCanvas or its SkSurface as a shader? 






--
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.

Brian Salomon

unread,
Oct 23, 2019, 2:43:40 PM10/23/19
to skia-d...@googlegroups.com
Oh gotcha... Then just do surface->makeImageSnapshot()->makeShader()

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/d8fa778d-4455-49a2-9536-6774ad2ce2b5%40googlegroups.com.

BenP

unread,
Oct 23, 2019, 3:12:49 PM10/23/19
to skia-discuss
Brilliant! Thank you!


B. 


On Wednesday, October 23, 2019 at 7:43:40 PM UTC+1, Brian Salomon wrote:
Oh gotcha... Then just do surface->makeImageSnapshot()->makeShader()

On Wed, Oct 23, 2019 at 2:34 PM BenP <ben...@gmail.com> wrote:
Thanks Brian... 

There is no bitmap. I've drawn to an SkSurface/SkCanvas, and now wish to use that as a shader. I'd like to avoid the CPU. 

B. 


On Wednesday, October 23, 2019 at 7:20:16 PM UTC+1, Brian Salomon wrote:
SkImage::MakeFromBitmap(bitmap)->makeTextureImage(<grcontext>)->makeShader();

On Wed, Oct 23, 2019 at 2:16 PM BenP <ben...@gmail.com> wrote:
Is there a GPU-friendly equivalent of SkBitmap->makeShader(), so I can use an SkCanvas or its SkSurface as a shader? 






--
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 view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/74500bd2-f7bd-4493-8683-d6d082cece31%40googlegroups.com.

--
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.
Reply all
Reply to author
Forward
0 new messages