Krita Source Code Documentation
Loading...
Searching...
No Matches
KoGamutMappingUtils.cpp File Reference
#include "KoGamutMappingUtils.h"
#include <kis_global.h>
#include <KoColorModelStandardIds.h>
#include <KoColorSpace.h>
#include <KoColor.h>
#include <KoColorConversions.h>
#include <KoColorTransferFunctions.h>
#include <QtMath>

Go to the source code of this file.

Functions

static void AsSlopeIntercept (float &m, float &b, float x0, float x1, float y0, float y1)
 
static float EvalDerivativeLinearGamma (float m, float b, float g, float x)
 
static void SolveAB (float &lnA, float &B, float x0, float y0, float m)
 

Variables

const QMatrix4x4 lmsToICtCp
 
const QMatrix4x4 lmsToICtCp_inv = lmsToICtCp.inverted()
 
const QMatrix4x4 lmsToOkLab
 
const QMatrix4x4 lmsToOkLab_inv = lmsToOkLab.inverted()
 
const QMatrix4x4 xyz50To65
 
const QMatrix4x4 xyz50To65_inv = xyz50To65.inverted()
 
const QMatrix4x4 XYZd65toDolbyLMS
 
const QMatrix4x4 XYZd65toDolbyLMS_inv = XYZd65toDolbyLMS.inverted()
 
const QMatrix4x4 XYZtoOkLABLMS
 
const QMatrix4x4 XYZtoOkLABLMS_inv = XYZtoOkLABLMS.inverted()
 

Function Documentation

◆ AsSlopeIntercept()

static void AsSlopeIntercept ( float & m,
float & b,
float x0,
float x1,
float y0,
float y1 )
static

Definition at line 39 of file KoGamutMappingUtils.cpp.

40{
41 float dy = (y1-y0);
42 float dx = (x1-x0);
43 if (dx == 0)
44 m = 1.0f;
45 else
46 m = dy/dx;
47
48 b = y0 - x0*m;
49}

◆ EvalDerivativeLinearGamma()

static float EvalDerivativeLinearGamma ( float m,
float b,
float g,
float x )
static

Definition at line 51 of file KoGamutMappingUtils.cpp.

52{
53 float ret = g*m*powf(m*x+b,g-1.0f);
54 return ret;
55}

◆ SolveAB()

static void SolveAB ( float & lnA,
float & B,
float x0,
float y0,
float m )
static

Definition at line 33 of file KoGamutMappingUtils.cpp.

34{
35 B = (m*x0)/y0;
36 lnA = logf(y0) - B*logf(x0);
37}

References B.

Variable Documentation

◆ lmsToICtCp

const QMatrix4x4 lmsToICtCp
Initial value:
{QMatrix4x4(
2048.0 / 4096.0, 2048.0 / 4096.0, 0.0 , 0.0,
6610.0 / 4096.0, -13613.0 / 4096.0, 7003.0 / 4096.0 , 0.0,
17933.0 / 4096.0, -17390.0 / 4096.0, -543.0 / 4096.0, 0.0,
0.0, 0.0, 0.0, 1.0
)}

Definition at line 202 of file KoGamutMappingUtils.cpp.

202 {QMatrix4x4(
203 2048.0 / 4096.0, 2048.0 / 4096.0, 0.0 , 0.0,
204 6610.0 / 4096.0, -13613.0 / 4096.0, 7003.0 / 4096.0 , 0.0,
205 17933.0 / 4096.0, -17390.0 / 4096.0, -543.0 / 4096.0, 0.0,
206 0.0, 0.0, 0.0, 1.0
207 )};

◆ lmsToICtCp_inv

const QMatrix4x4 lmsToICtCp_inv = lmsToICtCp.inverted()

Definition at line 209 of file KoGamutMappingUtils.cpp.

◆ lmsToOkLab

const QMatrix4x4 lmsToOkLab
Initial value:
{QMatrix4x4(
0.2104542683093140, 0.7936177747023054, -0.0040720430116193, 0.0,
1.9779985324311684, -2.4285922420485799, 0.4505937096174110, 0.0,
0.0259040424655478, 0.7827717124575296, -0.8086757549230774, 0.0,
0.0, 0.0, 0.0, 1.0
)}

Definition at line 184 of file KoGamutMappingUtils.cpp.

184 {QMatrix4x4(
185 0.2104542683093140, 0.7936177747023054, -0.0040720430116193, 0.0,
186 1.9779985324311684, -2.4285922420485799, 0.4505937096174110, 0.0,
187 0.0259040424655478, 0.7827717124575296, -0.8086757549230774, 0.0,
188 0.0, 0.0, 0.0, 1.0
189 )};

◆ lmsToOkLab_inv

const QMatrix4x4 lmsToOkLab_inv = lmsToOkLab.inverted()

Definition at line 191 of file KoGamutMappingUtils.cpp.

◆ xyz50To65

const QMatrix4x4 xyz50To65
Initial value:
{QMatrix4x4(
0.955473421488075, -0.02309845494876471, 0.06325924320057072, 0.0,
-0.0283697093338637, 1.0099953980813041, 0.021041441191917323, 0.0,
0.012314014864481998, -0.020507649298898964, 1.330365926242124, 0.0,
0.0, 0.0, 0.0, 1.0
)}

Definition at line 166 of file KoGamutMappingUtils.cpp.

166 {QMatrix4x4(
167 0.955473421488075, -0.02309845494876471, 0.06325924320057072, 0.0,
168 -0.0283697093338637, 1.0099953980813041, 0.021041441191917323, 0.0,
169 0.012314014864481998, -0.020507649298898964, 1.330365926242124, 0.0,
170 0.0, 0.0, 0.0, 1.0
171 )};

◆ xyz50To65_inv

const QMatrix4x4 xyz50To65_inv = xyz50To65.inverted()

Definition at line 173 of file KoGamutMappingUtils.cpp.

◆ XYZd65toDolbyLMS

const QMatrix4x4 XYZd65toDolbyLMS
Initial value:
{QMatrix4x4(
0.3592832590121217, 0.6976051147779502, -0.0358915932320290, 0.0,
-0.1920808463704993, 1.1004767970374321, 0.0753748658519118, 0.0,
0.0070797844607479, 0.0748396662186362, 0.8433265453898765, 0.0,
0.0, 0.0, 0.0, 1.0
)}

Definition at line 193 of file KoGamutMappingUtils.cpp.

193 {QMatrix4x4(
194 0.3592832590121217, 0.6976051147779502, -0.0358915932320290, 0.0,
195 -0.1920808463704993, 1.1004767970374321, 0.0753748658519118, 0.0,
196 0.0070797844607479, 0.0748396662186362, 0.8433265453898765, 0.0,
197 0.0, 0.0, 0.0, 1.0
198 )};

◆ XYZd65toDolbyLMS_inv

const QMatrix4x4 XYZd65toDolbyLMS_inv = XYZd65toDolbyLMS.inverted()

Definition at line 200 of file KoGamutMappingUtils.cpp.

◆ XYZtoOkLABLMS

const QMatrix4x4 XYZtoOkLABLMS
Initial value:
{QMatrix4x4(
0.8190224379967030, 0.3619062600528904, -0.1288737815209879, 0.0,
0.0329836539323885, 0.9292868615863434, 0.0361446663506424, 0.0,
0.0481771893596242, 0.2642395317527308, 0.6335478284694309, 0.0,
0.0, 0.0, 0.0, 1.0
)}

Definition at line 175 of file KoGamutMappingUtils.cpp.

175 {QMatrix4x4(
176 0.8190224379967030, 0.3619062600528904, -0.1288737815209879, 0.0,
177 0.0329836539323885, 0.9292868615863434, 0.0361446663506424, 0.0,
178 0.0481771893596242, 0.2642395317527308, 0.6335478284694309, 0.0,
179 0.0, 0.0, 0.0, 1.0
180 )};

◆ XYZtoOkLABLMS_inv

const QMatrix4x4 XYZtoOkLABLMS_inv = XYZtoOkLABLMS.inverted()

Definition at line 182 of file KoGamutMappingUtils.cpp.