summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-12-01 15:24:38 -0500
committerTavian Barnes <tavianator@gmail.com>2011-12-01 15:24:38 -0500
commit0e6a0b0d3a3ea8dfabdbaddd2afa86fae65dc9e5 (patch)
treec76ed55192418389f911ba1c04cd483ad516e7a1
parent0f05fc51962da8a7df269d51649cd8e1b683470c (diff)
downloaddimension-0e6a0b0d3a3ea8dfabdbaddd2afa86fae65dc9e5.tar.xz
Add .intensity() and .gray() methods to Colors.
-rw-r--r--libdimension-python/wrapper.pyx5
1 files changed, 5 insertions, 0 deletions
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):