sync with experimental
[luatex.git] / source / libs / poppler / poppler-0.39.0 / splash / SplashTypes.h
blob5ea816007f8458229c0cb53018834a7e91548591
1 //========================================================================
2 //
3 // SplashTypes.h
4 //
5 //========================================================================
7 //========================================================================
8 //
9 // Modified under the Poppler project - http://poppler.freedesktop.org
11 // All changes made under the Poppler project to this file are licensed
12 // under GPL version 2 or later
14 // Copyright (C) 2006, 2010 Albert Astals Cid <aacid@kde.org>
15 // Copyright (C) 2008 Tomas Are Haavet <tomasare@gmail.com>
16 // Copyright (C) 2009, 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
17 // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com>
18 // Copyright (C) 2010 William Bader <williambader@hotmail.com>
20 // To see a description of the changes please see the Changelog file that
21 // came with your tarball or type make ChangeLog if you are building from git
23 //========================================================================
25 #ifndef SPLASHTYPES_H
26 #define SPLASHTYPES_H
28 #include "goo/gtypes.h"
30 //------------------------------------------------------------------------
31 // coordinates
32 //------------------------------------------------------------------------
34 #if USE_FIXEDPOINT
35 #include "goo/FixedPoint.h"
36 typedef FixedPoint SplashCoord;
37 #elif USE_FLOAT
38 typedef float SplashCoord;
39 #else
40 typedef double SplashCoord;
41 #endif
43 //------------------------------------------------------------------------
44 // antialiasing
45 //------------------------------------------------------------------------
47 #define splashAASize 4
49 #ifndef SPOT_NCOMPS
50 #define SPOT_NCOMPS 4
51 #endif
53 //------------------------------------------------------------------------
54 // colors
55 //------------------------------------------------------------------------
57 enum SplashColorMode {
58 splashModeMono1, // 1 bit per component, 8 pixels per byte,
59 // MSbit is on the left
60 splashModeMono8, // 1 byte per component, 1 byte per pixel
61 splashModeRGB8, // 1 byte per component, 3 bytes per pixel:
62 // RGBRGB...
63 splashModeBGR8, // 1 byte per component, 3 bytes per pixel:
64 // BGRBGR...
65 splashModeXBGR8 // 1 byte per component, 4 bytes per pixel:
66 // XBGRXBGR...
67 #if SPLASH_CMYK
69 splashModeCMYK8, // 1 byte per component, 4 bytes per pixel:
70 // CMYKCMYK...
71 splashModeDeviceN8 // 1 byte per component,
72 // 4 bytes + n bytes spot colors per pixel:
73 // CMYKSSSSCMYKSSSS...
74 #endif
77 enum SplashThinLineMode {
78 splashThinLineDefault, // if SA on: draw solid if requested line width, transformed into
79 // device space, is less than half a pixel and a shaped line else
80 splashThinLineSolid, // draw line solid at least with 1 pixel
81 splashThinLineShape // draw line shaped at least with 1 pixel
83 // number of components in each color mode
84 // (defined in SplashState.cc)
85 extern int splashColorModeNComps[];
87 // max number of components in any SplashColor
88 #if SPLASH_CMYK
89 #define splashMaxColorComps SPOT_NCOMPS+4
90 #else
91 #define splashMaxColorComps 4
92 #endif
94 typedef Guchar SplashColor[splashMaxColorComps];
95 typedef Guchar *SplashColorPtr;
97 // RGB8
98 static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; }
99 static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; }
100 static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; }
102 // BGR8
103 static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; }
104 static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; }
105 static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; }
107 #if SPLASH_CMYK
108 // CMYK8
109 static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; }
110 static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; }
111 static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; }
112 static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; }
114 // DEVICEN8
115 static inline Guchar splashDeviceN8C(SplashColorPtr deviceN8) { return deviceN8[0]; }
116 static inline Guchar splashDeviceN8M(SplashColorPtr deviceN8) { return deviceN8[1]; }
117 static inline Guchar splashDeviceN8Y(SplashColorPtr deviceN8) { return deviceN8[2]; }
118 static inline Guchar splashDeviceN8K(SplashColorPtr deviceN8) { return deviceN8[3]; }
119 static inline Guchar splashDeviceN8S(SplashColorPtr deviceN8, int nSpot) { return deviceN8[4 + nSpot]; }
120 #endif
122 static inline void splashClearColor(SplashColorPtr dest) {
123 dest[0] = 0;
124 dest[1] = 0;
125 dest[2] = 0;
126 #if SPLASH_CMYK
127 dest[3] = 0;
128 for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++)
129 dest[i] = 0;
130 #endif
133 static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
134 dest[0] = src[0];
135 dest[1] = src[1];
136 dest[2] = src[2];
137 #if SPLASH_CMYK
138 dest[3] = src[3];
139 for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++)
140 dest[i] = src[i];
141 #endif
144 static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) {
145 dest[0] ^= src[0];
146 dest[1] ^= src[1];
147 dest[2] ^= src[2];
148 #if SPLASH_CMYK
149 dest[3] ^= src[3];
150 for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++)
151 dest[i] ^= src[i];
152 #endif
155 //------------------------------------------------------------------------
156 // blend functions
157 //------------------------------------------------------------------------
159 typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest,
160 SplashColorPtr blend, SplashColorMode cm);
162 //------------------------------------------------------------------------
163 // screen parameters
164 //------------------------------------------------------------------------
166 enum SplashScreenType {
167 splashScreenDispersed,
168 splashScreenClustered,
169 splashScreenStochasticClustered
172 struct SplashScreenParams {
173 SplashScreenType type;
174 int size;
175 int dotRadius;
176 SplashCoord gamma;
177 SplashCoord blackThreshold;
178 SplashCoord whiteThreshold;
181 //------------------------------------------------------------------------
182 // error results
183 //------------------------------------------------------------------------
185 typedef int SplashError;
188 //------------------------------------------------------------------------
189 // image file formats
190 //------------------------------------------------------------------------
192 enum SplashImageFileFormat {
193 splashFormatJpeg,
194 splashFormatPng,
195 splashFormatTiff,
196 splashFormatJpegCMYK
199 #endif