From b459f817b61b713eb13be4c39196a7cbfa990527 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Sat, 16 Jul 2011 02:19:36 +0000 Subject: [PATCH] add rgbgradient and cmykgradient to force color space git-svn-id: http://svn.code.sf.net/p/pyx/code/trunk/pyx/pyx@3214 a4f5e268-e194-4f32-bce1-d30804cbbcc5 --- color.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/color.py b/color.py index 4686588b..4496a6d5 100644 --- a/color.py +++ b/color.py @@ -422,6 +422,29 @@ class functiongradient(gradient): return self.cls(**colordict) +class rgbgradient: + + "a gradient, which takes another gradient and returns rgb colors" + + def __init__(self, gradient): + self.gradient = gradient + + def getcolor(self, param): + return self.gradient.getcolor(param).rgb() + + +class cmykgradient: + + "a gradient, which takes another gradient and returns cmyk colors" + + def __init__(self, gradient): + self.gradient = gradient + + def getcolor(self, param): + return self.gradient.getcolor(param).cmyk() + + + gradient.Gray = lineargradient(gray.white, gray.black) gradient.Grey = gradient.Gray gradient.ReverseGray = lineargradient(gray.black, gray.white) @@ -453,6 +476,14 @@ gradient.Rainbow = lineargradient(hsb(0, 1, 1), hsb(2.0/3.0, 1, 1)) gradient.ReverseRainbow = lineargradient(hsb(2.0/3.0, 1, 1), hsb(0, 1, 1)) gradient.Hue = lineargradient(hsb(0, 1, 1), hsb(1, 1, 1)) gradient.ReverseHue = lineargradient(hsb(1, 1, 1), hsb(0, 1, 1)) +rgbgradient.Rainbow = rgbgradient(gradient.Rainbow) +rgbgradient.ReverseRainbow = rgbgradient(gradient.ReverseRainbow) +rgbgradient.Hue = rgbgradient(gradient.Hue) +rgbgradient.ReverseHue = rgbgradient(gradient.ReverseHue) +cmykgradient.Rainbow = cmykgradient(gradient.Rainbow) +cmykgradient.ReverseRainbow = cmykgradient(gradient.ReverseRainbow) +cmykgradient.Hue = cmykgradient(gradient.Hue) +cmykgradient.ReverseHue = cmykgradient(gradient.ReverseHue) class PDFextgstate(pdfwriter.PDFobject): -- 2.11.4.GIT