1 //========================================================================
5 //========================================================================
7 //========================================================================
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 //========================================================================
28 #include "goo/gtypes.h"
30 //------------------------------------------------------------------------
32 //------------------------------------------------------------------------
35 #include "goo/FixedPoint.h"
36 typedef FixedPoint SplashCoord
;
38 typedef float SplashCoord
;
40 typedef double SplashCoord
;
43 //------------------------------------------------------------------------
45 //------------------------------------------------------------------------
47 #define splashAASize 4
53 //------------------------------------------------------------------------
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:
63 splashModeBGR8
, // 1 byte per component, 3 bytes per pixel:
65 splashModeXBGR8
// 1 byte per component, 4 bytes per pixel:
69 splashModeCMYK8
, // 1 byte per component, 4 bytes per pixel:
71 splashModeDeviceN8
// 1 byte per component,
72 // 4 bytes + n bytes spot colors per pixel:
73 // CMYKSSSSCMYKSSSS...
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
89 #define splashMaxColorComps SPOT_NCOMPS+4
91 #define splashMaxColorComps 4
94 typedef Guchar SplashColor
[splashMaxColorComps
];
95 typedef Guchar
*SplashColorPtr
;
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]; }
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]; }
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]; }
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
]; }
122 static inline void splashClearColor(SplashColorPtr dest
) {
128 for (int i
= SPOT_NCOMPS
; i
< SPOT_NCOMPS
+ 4; i
++)
133 static inline void splashColorCopy(SplashColorPtr dest
, SplashColorPtr src
) {
139 for (int i
= SPOT_NCOMPS
; i
< SPOT_NCOMPS
+ 4; i
++)
144 static inline void splashColorXor(SplashColorPtr dest
, SplashColorPtr src
) {
150 for (int i
= SPOT_NCOMPS
; i
< SPOT_NCOMPS
+ 4; i
++)
155 //------------------------------------------------------------------------
157 //------------------------------------------------------------------------
159 typedef void (*SplashBlendFunc
)(SplashColorPtr src
, SplashColorPtr dest
,
160 SplashColorPtr blend
, SplashColorMode cm
);
162 //------------------------------------------------------------------------
164 //------------------------------------------------------------------------
166 enum SplashScreenType
{
167 splashScreenDispersed
,
168 splashScreenClustered
,
169 splashScreenStochasticClustered
172 struct SplashScreenParams
{
173 SplashScreenType type
;
177 SplashCoord blackThreshold
;
178 SplashCoord whiteThreshold
;
181 //------------------------------------------------------------------------
183 //------------------------------------------------------------------------
185 typedef int SplashError
;
188 //------------------------------------------------------------------------
189 // image file formats
190 //------------------------------------------------------------------------
192 enum SplashImageFileFormat
{