Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Why does using SkBlendMode::kClear produce a black box instead of clearing the area in Skia?

34 views
Skip to first unread message

stephane

unread,
Jan 27, 2025, 8:07:36 PMJan 27
to skia-discuss

I'm trying to erase a rectangle on an SkCanvas by setting the paint's blend mode to kClear. However, instead of getting a transparent area, I end up with a solid black rectangle. Here's a minimal snippet:

paint.setBlendMode(SkBlendMode::kClear);
canvas->drawRect(rect, paint);


I expected the rectangle to become fully transparent, but I'm seeing black where I cleared.
  • Why does this produce black instead of a transparent hole?
  • How can I make the rectangle truly transparent?

thanks you by advance

craste...@gmail.com

unread,
Jan 31, 2025, 10:59:55 AMJan 31
to skia-discuss
Is it a 32 bit color surface?
Or Alpha 8 bit?

Greg Daniel

unread,
Jan 31, 2025, 11:05:51 AMJan 31
to skia-d...@googlegroups.com
Can you make an example on fiddle.skia.org please.

--
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 visit https://groups.google.com/d/msgid/skia-discuss/e46ee77f-28df-45d2-8414-070afbf538d4n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages