Why Blender is missing in canvaskit?

82 views
Skip to first unread message

food big

unread,
Jul 14, 2023, 8:28:39 AM7/14/23
to skia-discuss
Hello,

I'm trying to blend an image to surface with custom `Blender` on canvaskit. Howerver, `Blender` and `Paint::setBlender()` are not exist in canvaskit. Only `BlendMode` and `Paint::setBlendMode()` are exist.

Why Blender is missing in canvaskit? And how can I use custom blender in canvaskit

John Stiles

unread,
Jul 14, 2023, 8:59:25 AM7/14/23
to skia-d...@googlegroups.com
This appears to have just been an oversight. Blenders were added to the Skia API after CanvasKit was originally implemented, and CK just needs to be updated to add support for them. Thanks for the heads-up.

--
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/6b9b8640-451b-4ed3-aa80-480f63afb3b1n%40googlegroups.com.

food big

unread,
Jul 15, 2023, 9:40:19 AM7/15/23
to skia-discuss
Thank you for your quick reply!
Is there any action I should do from now on?

2023년 7월 14일 금요일 오후 9시 59분 25초 UTC+9에 johns...@google.com님이 작성:

Brian Osman

unread,
Jul 15, 2023, 9:51:16 AM7/15/23
to skia-d...@googlegroups.com
We've filed a bug - not sure when it's going to happen, but you can follow along at skbug.com/14621. Depending on how often you need to do the custom blending, you can work around it (with a possible performance penalty) by doing something like:

- Draw first content to surface
- makeImageSnapshot() to convert destination surface to an image
- Create a runtime shader that reads from both the image and whatever content you want to blend over it
- Do the custom blending in the runtime shader instead

If you want to do repeated drawing with custom blending, this doesn't work very well (you have to keep re-converting the surface to an image), but if it's just a single final draw with a custom blend mode, it should be okay.

food big

unread,
Jul 21, 2023, 1:03:38 PM7/21/23
to skia-discuss
Thank you for suggesting an alternative.

But just binding skia's blender api to canvaskit seemed easy, so I decided to do it myself.
And I'm struggling on gerrit now. 


727676: Add Blender of RuntimeEffect to canvaskit | https://skia-review.googlesource.com/c/skia/+/727676
2023년 7월 15일 토요일 오후 10시 51분 16초 UTC+9에 brian...@google.com님이 작성:

aron Leonard

unread,
Jul 22, 2023, 8:44:17 AM7/22/23
to skia-d...@googlegroups.com
Hi there,

Thanks for updating me on your progress. It's great to hear that you're taking the initiative to explore alternative solutions. I encourage you to continue your efforts, and if you need any relevant resources or support, please don't hesitate to reach out to me.

Best regards,

Aron

Reply all
Reply to author
Forward
0 new messages