source: trunk/poppler/mypoppler/poppler/GfxState_helpers.h @ 461

Last change on this file since 461 was 277, checked in by rbri, 12 years ago

PDF plugin: Poppler library updated to version 0.12.3

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1//========================================================================
2//
3// GfxState.cc
4//
5// Copyright 1996-2003 Glyph & Cog, LLC
6//
7//========================================================================
8
9//========================================================================
10//
11// Modified under the Poppler project - http://poppler.freedesktop.org
12//
13// All changes made under the Poppler project to this file are licensed
14// under GPL version 2 or later
15//
16// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
17//
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
20//
21//========================================================================
22
23static inline GfxColorComp clip01(GfxColorComp x) {
24  return (x < 0) ? 0 : (x > gfxColorComp1) ? gfxColorComp1 : x;
25}
26
27static inline double clip01(double x) {
28  return (x < 0) ? 0 : (x > 1) ? 1 : x;
29}
30
31static 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)
32{
33  double x;
34  // this is a matrix multiplication, unrolled for performance
35  //                        C M Y K
36  x = c1 * m1 * y1 * k1; // 0 0 0 0
37  r = g = b = x;
38  x = c1 * m1 * y1 * k;  // 0 0 0 1
39  r += 0.1373 * x;
40  g += 0.1216 * x;
41  b += 0.1255 * x;
42  x = c1 * m1 * y  * k1; // 0 0 1 0
43  r += x;
44  g += 0.9490 * x;
45  x = c1 * m1 * y  * k;  // 0 0 1 1
46  r += 0.1098 * x;
47  g += 0.1020 * x;
48  x = c1 * m  * y1 * k1; // 0 1 0 0
49  r += 0.9255 * x;
50  b += 0.5490 * x;
51  x = c1 * m  * y1 * k;  // 0 1 0 1
52  r += 0.1412 * x;
53  x = c1 * m  * y  * k1; // 0 1 1 0
54  r += 0.9294 * x;
55  g += 0.1098 * x;
56  b += 0.1412 * x;
57  x = c1 * m  * y  * k;  // 0 1 1 1
58  r += 0.1333 * x;
59  x = c  * m1 * y1 * k1; // 1 0 0 0
60  g += 0.6784 * x;
61  b += 0.9373 * x;
62  x = c  * m1 * y1 * k;  // 1 0 0 1
63  g += 0.0588 * x;
64  b += 0.1412 * x;
65  x = c  * m1 * y  * k1; // 1 0 1 0
66  g += 0.6510 * x;
67  b += 0.3137 * x;
68  x = c  * m1 * y  * k;  // 1 0 1 1
69  g += 0.0745 * x;
70  x = c  * m  * y1 * k1; // 1 1 0 0
71  r += 0.1804 * x;
72  g += 0.1922 * x;
73  b += 0.5725 * x;
74  x = c  * m  * y1 * k;  // 1 1 0 1
75  b += 0.0078 * x;
76  x = c  * m  * y  * k1; // 1 1 1 0
77  r += 0.2118 * x;
78  g += 0.2119 * x;
79  b += 0.2235 * x;
80}
Note: See TracBrowser for help on using the repository browser.