source: trunk/poppler/mypoppler/splash/SplashTypes.h @ 44

Last change on this file since 44 was 44, checked in by Eugene Romanenko, 15 years ago

poppler updated to version 0.5.3, related changes

File size: 4.7 KB
Line 
1//========================================================================
2//
3// SplashTypes.h
4//
5//========================================================================
6
7#ifndef SPLASHTYPES_H
8#define SPLASHTYPES_H
9
10#include "goo/gtypes.h"
11
12//------------------------------------------------------------------------
13// coordinates
14//------------------------------------------------------------------------
15
16#if USE_FIXEDPOINT
17#include "goo/FixedPoint.h"
18typedef FixedPoint SplashCoord;
19#else
20typedef double SplashCoord;
21#endif
22
23//------------------------------------------------------------------------
24// colors
25//------------------------------------------------------------------------
26
27enum SplashColorMode {
28  splashModeMono1,              // 1 bit per component, 8 pixels per byte,
29                                //   MSbit is on the left
30  splashModeMono8,              // 1 byte per component, 1 byte per pixel
31  splashModeAMono8,             // 1 byte per component, 2 bytes per pixel:
32                                //   AMAM...
33  splashModeRGB8,               // 1 byte per component, 3 bytes per pixel:
34                                //   RGBRGB...
35  splashModeBGR8,               // 1 byte per component, 3 bytes per pixel:
36                                //   BGRBGR...
37  splashModeARGB8,              // 1 byte per component, 4 bytes per pixel:
38                                //   ARGBARGB...
39  splashModeRGB8Qt,             // 1 byte per component, 4 bytes per pixel:
40                                //   Specially hacked to use in Qt frontends
41  splashModeBGRA8               // 1 byte per component, 4 bytes per pixel:
42                                //   BGRABGRA...
43#if SPLASH_CMYK
44  ,
45  splashModeCMYK8,              // 1 byte per component, 4 bytes per pixel:
46                                //   CMYKCMYK...
47  splashModeACMYK8              // 1 byte per component, 5 bytes per pixel:
48                                //   ACMYKACMYK
49#endif
50};
51
52// number of components in each color mode
53// (defined in SplashState.cc)
54extern int splashColorModeNComps[];
55
56// max number of components in any SplashColor
57#if SPLASH_CMYK
58#  define splashMaxColorComps 5
59#else
60#  define splashMaxColorComps 4
61#endif
62
63typedef Guchar SplashColor[splashMaxColorComps];
64typedef Guchar *SplashColorPtr;
65
66// AMono8
67static inline Guchar splashAMono8A(SplashColorPtr am8) { return am8[0]; }
68static inline Guchar splashAMono8M(SplashColorPtr am8) { return am8[1]; }
69
70// RGB8
71static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; }
72static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; }
73static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; }
74
75// BGR8
76static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; }
77static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; }
78static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; }
79
80// ARGB8
81static inline Guchar splashARGB8A(SplashColorPtr argb8) { return argb8[0]; }
82static inline Guchar splashARGB8R(SplashColorPtr argb8) { return argb8[1]; }
83static inline Guchar splashARGB8G(SplashColorPtr argb8) { return argb8[2]; }
84static inline Guchar splashARGB8B(SplashColorPtr argb8) { return argb8[3]; }
85
86// ARGB8
87static inline Guchar splashBGRA8A(SplashColorPtr bgra8) { return bgra8[3]; }
88static inline Guchar splashBGRA8R(SplashColorPtr bgra8) { return bgra8[2]; }
89static inline Guchar splashBGRA8G(SplashColorPtr bgra8) { return bgra8[1]; }
90static inline Guchar splashBGRA8B(SplashColorPtr bgra8) { return bgra8[0]; }
91
92#if SPLASH_CMYK
93// CMYK8
94static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; }
95static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; }
96static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; }
97static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; }
98
99// ACMYK8
100static inline Guchar splashACMYK8A(SplashColorPtr acmyk8) { return acmyk8[0]; }
101static inline Guchar splashACMYK8C(SplashColorPtr acmyk8) { return acmyk8[1]; }
102static inline Guchar splashACMYK8M(SplashColorPtr acmyk8) { return acmyk8[2]; }
103static inline Guchar splashACMYK8Y(SplashColorPtr acmyk8) { return acmyk8[3]; }
104static inline Guchar splashACMYK8K(SplashColorPtr acmyk8) { return acmyk8[4]; }
105#endif
106
107static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
108  dest[0] = src[0];
109  dest[1] = src[1];
110  dest[2] = src[2];
111  dest[3] = src[3];
112#if SPLASH_CMYK
113  dest[4] = src[4];
114#endif
115}
116
117static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) {
118  dest[0] ^= src[0];
119  dest[1] ^= src[1];
120  dest[2] ^= src[2];
121  dest[3] ^= src[3];
122#if SPLASH_CMYK
123  dest[4] ^= src[4];
124#endif
125}
126
127//------------------------------------------------------------------------
128// blend functions
129//------------------------------------------------------------------------
130
131typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest,
132                                SplashColorPtr blend, SplashColorMode cm);
133
134//------------------------------------------------------------------------
135// error results
136//------------------------------------------------------------------------
137
138typedef int SplashError;
139
140#endif
Note: See TracBrowser for help on using the repository browser.