GtkSnapshot and push_blur()

Hello, I’m trying to add a blur effect with GTK4 but there is a strange transparency effect around borders, any idea ?

class Picture(Gtk.Picture):
    def do_snapshot(self, snapshot):
        rect = Graphene.Rect()
        rect.init(
            0, 0, self.get_allocated_width(), self.get_allocated_height()
        )
        snapshot.push_blur(100)
        rgba=Gdk.RGBA()
        rgba.alpha = 0.5
        rgba.red = rgba.blue = rgba.green = 0
        Gtk.Picture.do_snapshot(self, snapshot)
        snapshot.pop()
        snapshot.append_color(rgba, rect)

Not sure what you mean exactly or what the expected outcome should be, but…

  1. That’s a rather large blur radius, you shouldn’t expect that to be usable performance-wise
  2. Don’t use get_allocated_width/height. You want get_witdth()/get_height().

Here the same blur with Pillow library, there is no transparency on image borders.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.