summaryrefslogtreecommitdiffstats
path: root/examples/logarithmic
blob: 731b27defd3163cf822ba811f41daa0087c9052a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- python -*-

# This example uses free function modifier and temporary
# curve linearisation to make the colour curves logarithmic.


# Copyright © 2014  Mattias Andrée (maandree@member.fsf.org)
# 
# Permission is granted to copy, distribute and/or modify this document
# under the terms of the GNU Free Documentation License, Version 1.3
# or any later version published by the Free Software Foundation;
# with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
# You should have received a copy of the GNU General Public License
# along with this software package.  If not, see <http://www.gnu.org/licenses/>.


import math

# Use linear RGB.
linearise()

# Make the curves logarithmic. The function applies
# to all colour curves, but you can change them
# individually by specifing three functions: red,
# green and blue.
manipulate(lambda x : math.log(x + 1, 2))

# Switch back to sRGB.
standardise()

# Apply settings, using vidmode.
(drm if ttymode else vidmode)()
#(drm if ttymode else randr)()