Philipp Hörist pushed to branch master at gajim / gajim
Commits:
3b1459f7 by Philipp Hörist at 2019-11-15T21:50:54Z
Avatar: Add get_avatar_from_pixbuf()
- - - - -
1 changed file:
- gajim/gtk/avatar.py
Changes:
=====================================
gajim/gtk/avatar.py
=====================================
@@ -165,6 +165,23 @@ def clip_circle(surface):
return context.get_target()
+def get_avatar_from_pixbuf(pixbuf, scale, show=None):
+ size = max(pixbuf.get_width(), pixbuf.get_height())
+ size *= scale
+ surface = Gdk.cairo_surface_create_from_pixbuf(pixbuf, scale)
+ if surface is None:
+ return None
+ surface = square(surface, size)
+ if surface is None:
+ return None
+ surface = clip_circle(surface)
+ if surface is None:
+ return None
+ if show is not None:
+ return add_status_to_avatar(surface, show)
+ return surface
+
+
class AvatarStorage(metaclass=Singleton):
def __init__(self):
self._cache = defaultdict(dict)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/3b1459f78e4672907e07cf0f34bd6bc1bd654b4a
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/3b1459f78e4672907e07cf0f34bd6bc1bd654b4a
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits