1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
9 //========================================================================
11 // Modified under the Poppler project - http://poppler.freedesktop.org
13 // All changes made under the Poppler project to this file are licensed
14 // under GPL version 2 or later
16 // Copyright (C) 2009, 2011 Albert Astals Cid <aacid@kde.org>
18 // To see a description of the changes please see the Changelog file that
19 // came with your tarball or type make ChangeLog if you are building from git
21 //========================================================================
25 static inline GfxColorComp
clip01(GfxColorComp x
) {
26 return (x
< 0) ? 0 : (x
> gfxColorComp1
) ? gfxColorComp1
: x
;
29 static inline double clip01(double x
) {
30 return (x
< 0) ? 0 : (x
> 1) ? 1 : x
;
33 static inline void cmykToRGBMatrixMultiplication(const double &c
, const double &m
, const double &y
, const double &k
, const double &c1
, const double &m1
, const double &y1
, const double &k1
, double &r
, double &g
, double &b
)
36 // this is a matrix multiplication, unrolled for performance
38 x
= c1
* m1
* y1
* k1
; // 0 0 0 0
40 x
= c1
* m1
* y1
* k
; // 0 0 0 1
44 x
= c1
* m1
* y
* k1
; // 0 0 1 0
47 x
= c1
* m1
* y
* k
; // 0 0 1 1
50 x
= c1
* m
* y1
* k1
; // 0 1 0 0
53 x
= c1
* m
* y1
* k
; // 0 1 0 1
55 x
= c1
* m
* y
* k1
; // 0 1 1 0
59 x
= c1
* m
* y
* k
; // 0 1 1 1
61 x
= c
* m1
* y1
* k1
; // 1 0 0 0
64 x
= c
* m1
* y1
* k
; // 1 0 0 1
67 x
= c
* m1
* y
* k1
; // 1 0 1 0
70 x
= c
* m1
* y
* k
; // 1 0 1 1
72 x
= c
* m
* y1
* k1
; // 1 1 0 0
76 x
= c
* m
* y1
* k
; // 1 1 0 1
78 x
= c
* m
* y
* k1
; // 1 1 1 0