Daniel Brötzmann pushed to branch mainwindow at gajim / gajim


Commits:
b24215a0 by wurstsalat at 2021-11-27T18:49:26+01:00
Avatar: Add convert_to_greyscale

- - - - -


1 changed file:

- gajim/gtk/avatar.py


Changes:

=====================================
gajim/gtk/avatar.py
=====================================
@@ -308,6 +308,19 @@ def round_corners(surface):
     return context.get_target()
 
 
+def convert_to_greyscale(surface):
+    context = cairo.Context(surface)
+    context.set_operator(cairo.Operator.HSL_COLOR)
+    context.set_source_rgb(1, 1, 1)
+    context.rectangle(0, 0, surface.get_width(), surface.get_height())
+    context.fill()
+    context.set_operator(cairo.Operator.ATOP)
+    context.set_source_rgba(1, 1, 1, 0.5)
+    context.rectangle(0, 0, surface.get_width(), surface.get_height())
+    context.fill()
+    return context.get_target()
+
+
 class AvatarStorage(metaclass=Singleton):
     def __init__(self):
         self._cache = defaultdict(dict)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/b24215a0c7336eee22621a5bdb73d30bc8171486

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/b24215a0c7336eee22621a5bdb73d30bc8171486
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

Reply via email to