def gamma_correct(cs, c):
 gamma = cs.gamma
 if (gamma == GAMMA_REC709):
  cc = 0.018
  if (c < cc):
   c = (((1.099 * math.pow(cc, 0.45)) - 0.099) / cc)
  else:
   c = ((1.099 * math.pow(c, 0.45)) - 0.099)
 else:
  c = math.pow(c, (1.0 / gamma))
 return c

def gamma_correct ( cs , c ) : gamma = cs . gamma if ( gamma == GAMMA_REC709 ) : cc = 0.018 if ( c < cc ) : c = ( ( ( 1.099 * math . pow ( cc , 0.45 ) ) - 0.099 ) / cc ) else : c = ( ( 1.099 * math . pow ( c , 0.45 ) ) - 0.099 ) else : c = math . pow ( c , ( 1.0 / gamma ) ) return c
transform linear rgb values to nonlinear rgb values .