SmartPDF - lightweight pdf viewer app for rosapps
[reactos.git] / rosapps / smartpdf / poppler / splash / SplashTypes.h
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"
18 typedef FixedPoint SplashCoord;
19 #else
20 typedef double SplashCoord;
21 #endif
22
23 //------------------------------------------------------------------------
24 // colors
25 //------------------------------------------------------------------------
26
27 enum 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)
54 extern 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
63 typedef Guchar SplashColor[splashMaxColorComps];
64 typedef Guchar *SplashColorPtr;
65
66 // AMono8
67 static inline Guchar splashAMono8A(SplashColorPtr am8) { return am8[0]; }
68 static inline Guchar splashAMono8M(SplashColorPtr am8) { return am8[1]; }
69
70 // RGB8
71 static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; }
72 static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; }
73 static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; }
74
75 // BGR8
76 static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; }
77 static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; }
78 static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; }
79
80 // ARGB8
81 static inline Guchar splashARGB8A(SplashColorPtr argb8) { return argb8[0]; }
82 static inline Guchar splashARGB8R(SplashColorPtr argb8) { return argb8[1]; }
83 static inline Guchar splashARGB8G(SplashColorPtr argb8) { return argb8[2]; }
84 static inline Guchar splashARGB8B(SplashColorPtr argb8) { return argb8[3]; }
85
86 // ARGB8
87 static inline Guchar splashBGRA8A(SplashColorPtr bgra8) { return bgra8[3]; }
88 static inline Guchar splashBGRA8R(SplashColorPtr bgra8) { return bgra8[2]; }
89 static inline Guchar splashBGRA8G(SplashColorPtr bgra8) { return bgra8[1]; }
90 static inline Guchar splashBGRA8B(SplashColorPtr bgra8) { return bgra8[0]; }
91
92 #if SPLASH_CMYK
93 // CMYK8
94 static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; }
95 static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; }
96 static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; }
97 static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; }
98
99 // ACMYK8
100 static inline Guchar splashACMYK8A(SplashColorPtr acmyk8) { return acmyk8[0]; }
101 static inline Guchar splashACMYK8C(SplashColorPtr acmyk8) { return acmyk8[1]; }
102 static inline Guchar splashACMYK8M(SplashColorPtr acmyk8) { return acmyk8[2]; }
103 static inline Guchar splashACMYK8Y(SplashColorPtr acmyk8) { return acmyk8[3]; }
104 static inline Guchar splashACMYK8K(SplashColorPtr acmyk8) { return acmyk8[4]; }
105 #endif
106
107 static 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
117 static 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
131 typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest,
132 SplashColorPtr blend, SplashColorMode cm);
133
134 //------------------------------------------------------------------------
135 // error results
136 //------------------------------------------------------------------------
137
138 typedef int SplashError;
139
140 #endif