From 0e6a0b0d3a3ea8dfabdbaddd2afa86fae65dc9e5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 1 Dec 2011 15:24:38 -0500 Subject: Add .intensity() and .gray() methods to Colors. --- libdimension-python/wrapper.pyx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libdimension-python/wrapper.pyx b/libdimension-python/wrapper.pyx index 2ed85e0..6ec7c15 100644 --- a/libdimension-python/wrapper.pyx +++ b/libdimension-python/wrapper.pyx @@ -458,6 +458,11 @@ cdef class Color: def __get__(self): return self._sRGB.filter + def intensity(self): + return dmnsn_color_intensity(self._c) + def gray(self): + return _Color(dmnsn_color_mul(self.intensity(), dmnsn_white)) + def __add__(lhs, rhs): return _sRGBColor(dmnsn_color_add(Color(lhs)._sRGB, Color(rhs)._sRGB)) def __mul__(lhs, rhs): -- cgit v1.2.3