def test21_DoTransformWithIncorrectInputBuffer(self): cmyk = cms.COLORB() rgb = 255 try: cms.cmsDoTransform(self.transform, rgb, cmyk) except cms.cmsError: return self.fail()
def test17_DoTransformWithNullInput(self): rgb = cms.COLORB() cmyk = cms.COLORB() cms.cmsDoTransform(self.transform, rgb, cmyk) self.assertNotEqual(0, cmyk[0]) self.assertNotEqual(0, cmyk[1]) self.assertNotEqual(0, cmyk[2]) self.assertNotEqual(0, cmyk[3])
def test20_DoTransformWithIncorrectColorValues(self): rgb = cms.COLORB() cmyk = cms.COLORB() rgb[0] = 455 rgb[1] = 255 rgb[2] = 255 try: cms.cmsDoTransform(self.transform, rgb, cmyk) except: self.fail()
def test22_DoTransformWithIncorrectOutputBuffer(self): rgb = cms.COLORB() rgb[0] = 255 rgb[1] = 255 rgb[2] = 255 cmyk = 255 try: cms.cmsDoTransform(self.transform, rgb, cmyk) except cms.cmsError: return self.fail()
def test19_DoTransformWithIntermediateInput(self): rgb = cms.COLORB() cmyk = cms.COLORB() rgb[0] = 100 rgb[1] = 190 rgb[2] = 150 cms.cmsDoTransform(self.transform, rgb, cmyk) self.assertNotEqual(0, cmyk[0]) self.assertNotEqual(0, cmyk[1]) self.assertNotEqual(0, cmyk[2]) self.assertNotEqual(0, cmyk[3])
def test18_DoTransformWithMaximumAllowedInput(self): rgb = cms.COLORB() cmyk = cms.COLORB() rgb[0] = 255 rgb[1] = 255 rgb[2] = 255 cms.cmsDoTransform(self.transform, rgb, cmyk) self.assertEqual(0, cmyk[0]) self.assertEqual(0, cmyk[1]) self.assertEqual(0, cmyk[2]) self.assertEqual(0, cmyk[3])
def processRGB(self,r,g,b): RGB = COLORB() RGB[0] = int(round(r, 3)*255) RGB[1] = int(round(g, 3)*255) RGB[2] = int(round(b, 3)*255) outRGB = COLORB() outRGB[0] = 0 outRGB[1] = 0 outRGB[2] = 0 cmsDoTransform(self.rgb_monitor, RGB, outRGB, 1) return round(outRGB[0]/255.0, 3), round(outRGB[1]/255.0, 3), round(outRGB[2]/255.0, 3)
def processCMYK(self,c,m,y,k): CMYK = COLORB() CMYK[0] = int(round(c, 3)*255) CMYK[1] = int(round(m, 3)*255) CMYK[2] = int(round(y, 3)*255) CMYK[3] = int(round(k, 3)*255) outRGB = COLORB() outRGB[0] = 0 outRGB[1] = 0 outRGB[2] = 0 cmsDoTransform(self.cmyk_rgb, CMYK, outRGB, 1) return round(outRGB[0]/255.0, 3), round(outRGB[1]/255.0, 3), round(outRGB[2]/255.0, 3)
def convertRGB(self,r,g,b): RGB = COLORB() RGB[0] = int(round(r, 3)*255) RGB[1] = int(round(g, 3)*255) RGB[2] = int(round(b, 3)*255) CMYK = COLORB() CMYK[0] = 0 CMYK[1] = 0 CMYK[2] = 0 CMYK[3] = 0 cmsDoTransform(self.rgb_cmyk, RGB, CMYK, 1) return round(CMYK[0]/255.0, 3), round(CMYK[1]/255.0, 3), round(CMYK[2]/255.0, 3), round(CMYK[3]/255.0, 3)
def processRGB(self, r, g, b): RGB = COLORB() RGB[0] = int(round(r, 3) * 255) RGB[1] = int(round(g, 3) * 255) RGB[2] = int(round(b, 3) * 255) outRGB = COLORB() outRGB[0] = 0 outRGB[1] = 0 outRGB[2] = 0 cmsDoTransform(self.rgb_monitor, RGB, outRGB, 1) return round(outRGB[0] / 255.0, 3), round(outRGB[1] / 255.0, 3), round(outRGB[2] / 255.0, 3)
def processCMYK(self, c, m, y, k): CMYK = COLORB() CMYK[0] = int(round(c, 3) * 255) CMYK[1] = int(round(m, 3) * 255) CMYK[2] = int(round(y, 3) * 255) CMYK[3] = int(round(k, 3) * 255) outRGB = COLORB() outRGB[0] = 0 outRGB[1] = 0 outRGB[2] = 0 cmsDoTransform(self.cmyk_rgb, CMYK, outRGB, 1) return round(outRGB[0] / 255.0, 3), round(outRGB[1] / 255.0, 3), round(outRGB[2] / 255.0, 3)
def convertRGB(self, r, g, b): RGB = COLORB() RGB[0] = int(round(r, 3) * 255) RGB[1] = int(round(g, 3) * 255) RGB[2] = int(round(b, 3) * 255) CMYK = COLORB() CMYK[0] = 0 CMYK[1] = 0 CMYK[2] = 0 CMYK[3] = 0 cmsDoTransform(self.rgb_cmyk, RGB, CMYK, 1) return round(CMYK[0] / 255.0, 3), round(CMYK[1] / 255.0, 3), round(CMYK[2] / 255.0, 3), round(CMYK[3] / 255.0, 3)