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

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

First import

File size: 4.6 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  splashModeBGRA8               // 1 byte per component, 4 bytes per pixel:
40                                //   BGRABGRA...
41#if SPLASH_CMYK
42  ,
43  splashModeCMYK8,              // 1 byte per component, 4 bytes per pixel:
44                                //   CMYKCMYK...
45  splashModeACMYK8              // 1 byte per component, 5 bytes per pixel:
46                                //   ACMYKACMYK
47#endif
48};
49
50// number of components in each color mode
51// (defined in SplashState.cc)
52extern int splashColorModeNComps[];
53
54// max number of components in any SplashColor
55#if SPLASH_CMYK
56#  define splashMaxColorComps 5
57#else
58#  define splashMaxColorComps 4
59#endif
60
61typedef Guchar SplashColor[splashMaxColorComps];
62typedef Guchar *SplashColorPtr;
63
64// AMono8
65static inline Guchar splashAMono8A(SplashColorPtr am8) { return am8[0]; }
66static inline Guchar splashAMono8M(SplashColorPtr am8) { return am8[1]; }
67
68// RGB8
69static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; }
70static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; }
71static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; }
72
73// BGR8
74static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; }
75static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; }
76static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; }
77
78// ARGB8
79static inline Guchar splashARGB8A(SplashColorPtr argb8) { return argb8[0]; }
80static inline Guchar splashARGB8R(SplashColorPtr argb8) { return argb8[1]; }
81static inline Guchar splashARGB8G(SplashColorPtr argb8) { return argb8[2]; }
82static inline Guchar splashARGB8B(SplashColorPtr argb8) { return argb8[3]; }
83
84// ARGB8
85static inline Guchar splashBGRA8A(SplashColorPtr bgra8) { return bgra8[3]; }
86static inline Guchar splashBGRA8R(SplashColorPtr bgra8) { return bgra8[2]; }
87static inline Guchar splashBGRA8G(SplashColorPtr bgra8) { return bgra8[1]; }
88static inline Guchar splashBGRA8B(SplashColorPtr bgra8) { return bgra8[0]; }
89
90#if SPLASH_CMYK
91// CMYK8
92static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; }
93static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; }
94static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; }
95static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; }
96
97// ACMYK8
98static inline Guchar splashACMYK8A(SplashColorPtr acmyk8) { return acmyk8[0]; }
99static inline Guchar splashACMYK8C(SplashColorPtr acmyk8) { return acmyk8[1]; }
100static inline Guchar splashACMYK8M(SplashColorPtr acmyk8) { return acmyk8[2]; }
101static inline Guchar splashACMYK8Y(SplashColorPtr acmyk8) { return acmyk8[3]; }
102static inline Guchar splashACMYK8K(SplashColorPtr acmyk8) { return acmyk8[4]; }
103#endif
104
105static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
106  dest[0] = src[0];
107  dest[1] = src[1];
108  dest[2] = src[2];
109  dest[3] = src[3];
110#if SPLASH_CMYK
111  dest[4] = src[4];
112#endif
113}
114
115static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) {
116  dest[0] ^= src[0];
117  dest[1] ^= src[1];
118  dest[2] ^= src[2];
119  dest[3] ^= src[3];
120#if SPLASH_CMYK
121  dest[4] ^= src[4];
122#endif
123}
124
125//------------------------------------------------------------------------
126// blend functions
127//------------------------------------------------------------------------
128
129typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest,
130                                SplashColorPtr blend, SplashColorMode cm);
131
132//------------------------------------------------------------------------
133// error results
134//------------------------------------------------------------------------
135
136typedef int SplashError;
137
138#endif
Note: See TracBrowser for help on using the repository browser.