#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Showcases colour component transfer functions (CCTF) relates computations.
"""

import colour
from colour.utilities.verbose import message_box

message_box('Colour Component Transfer Functions (CCTF) Computations')

C = 18 / 100

message_box(('Encoding to video component signal value using "BT.709" OETF '
             'and given linear-light value:\n'
             '\n\t{0}'.format(C)))
print(colour.oetf_BT709(C))
print(colour.oetf(C, function='BT.709'))

print('\n')

N = 0.4090077288641504
message_box(('Decoding to linear-light value using "BT.1886" EOTF and given '
             ' video component signal value:\n'
             '\n\t{0}'.format(N)))
print(colour.eotf_BT1886(N))
print(colour.eotf(N, function='BT.1886'))

print('\n')

message_box(('Encoding to "Cineon" using given linear-light value:\n'
             '\n\t{0}'.format(C)))
print(colour.log_encoding_Cineon(C))
print(colour.log_encoding_curve(C, curve='Cineon'))

print('\n')

N = 0.457319613085
message_box(('Decoding to linear-light using given "Cineon" code value:\n'
             '\n\t{0}'.format(N)))
print(colour.log_decoding_Cineon(N))
print(colour.log_decoding_curve(N, curve='Cineon'))

print('\n')

message_box(('Encoding to "PLog" using given linear-light value:\n'
             '\n\t{0}'.format(C)))
print(colour.log_encoding_PivotedLog(C))
print(colour.log_encoding_curve(C, curve='PLog'))

print('\n')

N = 0.434995112414
message_box(('Decoding to linear-light value using given "PLog" code value:\n'
             '\n\t{0}'.format(N)))
print(colour.log_decoding_PivotedLog(N))
print(colour.log_decoding_curve(N, curve='PLog'))

print('\n')

@@ -1650,28 +1650,474 @@
 curve='PLog'))%0A%0Aprint('%5Cn')%0A
+%0Amessage_box(('Encoding to video component signal value using a pure gamma '%0A             'function and given linear-light value:%5Cn'%0A             '%5Cn%5Ct%7B0%7D'.format(C)))%0Aprint(colour.gamma_function(C, 1 / 2.2))%0A%0Aprint('%5Cn')%0A%0AN = 0.458656446864%0Amessage_box(('Decoding to linear-light value using a pure gamma function and '%0A             'given video component signal value:%5Cn'%0A             '%5Cn%5Ct%7B0%7D'.format(N)))%0Aprint(colour.gamma_function(N, 2.2))%0A

Add gamma function usage examples.