From efd8d48b421d553085d33f7c97c716e92a925299 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 27 Jul 2019 17:34:23 -0700 Subject: [PATCH] Add color_rgba helper for gradient stops --- wx/svg/_nanosvg.pyx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wx/svg/_nanosvg.pyx b/wx/svg/_nanosvg.pyx index 68b3486d..51951ebb 100644 --- a/wx/svg/_nanosvg.pyx +++ b/wx/svg/_nanosvg.pyx @@ -518,6 +518,15 @@ cdef class SVGgradientStop: self._check_ptr() return self._ptr.color + @property + def color_rgba(self) -> tuple: + """ Returns color as a RGBA tuple """ + c = self.color + return ( c & 0xff, + (c >> 8) & 0xff, + (c >> 16) & 0xff, + (c >> 24) & 0xff) + @property def offset(self) -> float: self._check_ptr()