mς %U²Ic@sdZddddddgZddZdd Zd dZd „Zd „Zd „Zd„Zd„Z d„Z d„Z dS(sζConversion functions between RGB and other color systems. This modules provides two functions for each color system ABC: rgb_to_abc(r, g, b) --> a, b, c abc_to_rgb(a, b, c) --> r, g, b All inputs and outputs are triples of floats in the range [0.0...1.0]. Inputs outside this range may cause exceptions or invalid outputs. Supported color systems: RGB: Red, Green, Blue components YIQ: used by composite video signals HLS: Hue, Luminance, Saturation HSV: Hue, Saturation, Value t rgb_to_yiqt yiq_to_rgbt rgb_to_hlst hls_to_rgbt rgb_to_hsvt hsv_to_rgbf1.0f3.0f6.0f2.0cCs[d|d|d|}d|d|d|}d|d|d |}|||fS( Nf0.29999999999999999f0.58999999999999997f0.11f0.59999999999999998f0.28000000000000003f0.32000000000000001f0.20999999999999999f0.52000000000000002f0.31(trtgtbtytitq(RRRR R R ((t%/data/zmath/lib/python2.4/colorsys.pyR"scCsΩ|d|d|}|d|d|}|d|d|}|djo d}n|djo d}n|djo d}n|djo d}n|djo d}n|djo d}n|||fS( Nf0.94826200000000005f0.62401300000000004f0.27606599999999998f0.63980999999999999f1.10545f1.72986f0.0f1.0(R R R RRR(R R R RRR((R R(s       c Cs"t|||ƒ} t|||ƒ}|| d}|| jod|dfSn|djo| || |}n| |d| |}| || |}| || |}| || |}|| jo||} n.|| jod||} nd||} | dd} | ||fS(Nf2.0f0.0f0.5f4.0f6.0f1.0( tmaxRRRtmaxctmintminctltstrctgctbcth( RRRRRRRRRRR((R R:s$    cCs–|djo|||fSn|djo|d|}n||||}d||}t|||tƒt|||ƒt|||tƒfS(Nf0.0f0.5f1.0f2.0(RRtm2tm1t_vRt ONE_THIRD(RRRRR((R RKs  cCsq|d}|tjo||||dSn|djo|Sn|tjo|||t|dSn|S(Nf1.0f6.0f0.5(thuet ONE_SIXTHRRt TWO_THIRD(RRR((R RRs    c Csοt|||ƒ} t|||ƒ}| }|| jodd|fSn| || }| || |}| || |}| || |}|| jo||} n.|| jod||} nd||} | dd} | ||fS(Nf0.0f2.0f4.0f6.0f1.0( R RRRRRRtvRRRRR( RRRRRRRRRRR((R R_s    cCs.|djo|||fSnt|dƒ}|d|}|d|}|d||}|d|d|}|ddjo|||fSn|djo|||fSn|djo|||fSn|djo|||fSn|d jo|||fSn|d jo|||fSndS( Nf0.0f6.0f1.0iiiiiii( RRtintRR tftpR tt(RRRR R R!R R"((R Rns&      N( t__doc__t__all__RRRRRRRRRR( RRR$RRRRRRRR((R t?s