def new_blank_pixbuf(rgb, w, h): """Create a blank pixbuf with all pixels set to a color :param tuple rgb: Color to blank the pixbuf to (``R,G,B``, floats) :param int w: Width for the new pixbuf :param int h: Width for the new pixbuf The returned pixbuf has no alpha channel. """ pixbuf = GdkPixbuf.Pixbuf.new( GdkPixbuf.Colorspace.RGB, False, 8, w, h, ) r, g, b = (helpers.clamp(int(round(0xff * x)), 0, 0xff) for x in rgb) rgba_pixel = (r << 24) + (g << 16) + (b << 8) + 0xff pixbuf.fill(rgba_pixel) return pixbuf