blob: 19c20b1bc533bc6f05b2191e12b3145f75773e56 (
plain) (
tree)
|
|
# -*- python -*-
# This example uses free function modifier and temporary
# curve linearisation to make the colour curves logarithmic.
# Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
#
# 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 the red (first argument) and green (second
# argument) colour curves. `...` is used to use the
# same value as the argument before it. `None`,
# which is used for the blue colour curve, means
# that no adjustment is made, which is the same
# thing as using `lambda x : x`.
manipulate(lambda x : math.log(x + 1, 2), ..., None)
# Switch back to sRGB.
standardise()
# Alternatively you can use `cie_manipulate` instead
# of `manipulate`. To to the logaritmisation in the
# CIE xyY colour space. If doing so, do not use
# `linearise`–`standardise`.
# Apply settings, using vidmode.
(drm if ttymode else vidmode)()
#(drm if ttymode else randr)()
|