# use AROS_LIB/INCLUDES
[AROS-Contrib.git] / arospdf / splash / SplashTypes.h
blob35551b90ab57fcad7ede2b5bb0cc2294b97a783b
1 //========================================================================
2 //
3 // SplashTypes.h
4 //
5 //========================================================================
7 #ifndef SPLASHTYPES_H
8 #define SPLASHTYPES_H
10 #include <aconf.h>
11 #include "gtypes.h"
13 //------------------------------------------------------------------------
14 // coordinates
15 //------------------------------------------------------------------------
17 #if USE_FIXEDPOINT
18 #include "FixedPoint.h"
19 typedef FixedPoint SplashCoord;
20 #else
21 typedef double SplashCoord;
22 #endif
24 //------------------------------------------------------------------------
25 // antialiasing
26 //------------------------------------------------------------------------
28 #define splashAASize 4
30 //------------------------------------------------------------------------
31 // colors
32 //------------------------------------------------------------------------
34 enum SplashColorMode {
35 splashModeMono1, // 1 bit per component, 8 pixels per byte,
36 // MSbit is on the left
37 splashModeMono8, // 1 byte per component, 1 byte per pixel
38 splashModeRGB8, // 1 byte per component, 3 bytes per pixel:
39 // RGBRGB...
40 splashModeBGR8 // 1 byte per component, 3 bytes per pixel:
41 // BGRBGR...
43 #if SPLASH_CMYK
45 splashModeCMYK8 // 1 byte per component, 4 bytes per pixel:
46 // CMYKCMYK...
47 #endif
50 // number of components in each color mode
51 // (defined in SplashState.cc)
52 extern int splashColorModeNComps[];
54 // max number of components in any SplashColor
55 #if SPLASH_CMYK
56 # define splashMaxColorComps 4
57 #else
58 # define splashMaxColorComps 3
59 #endif
61 typedef Guchar SplashColor[splashMaxColorComps];
62 typedef Guchar *SplashColorPtr;
64 // RGB8
65 static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; }
66 static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; }
67 static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; }
69 // BGR8
70 static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; }
71 static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; }
72 static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; }
74 #if SPLASH_CMYK
75 // CMYK8
76 static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; }
77 static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; }
78 static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; }
79 static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; }
80 #endif
82 static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
83 dest[0] = src[0];
84 dest[1] = src[1];
85 dest[2] = src[2];
86 #if SPLASH_CMYK
87 dest[3] = src[3];
88 #endif
91 static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) {
92 dest[0] ^= src[0];
93 dest[1] ^= src[1];
94 dest[2] ^= src[2];
95 #if SPLASH_CMYK
96 dest[3] ^= src[3];
97 #endif
100 //------------------------------------------------------------------------
101 // blend functions
102 //------------------------------------------------------------------------
104 typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest,
105 SplashColorPtr blend, SplashColorMode cm);
107 //------------------------------------------------------------------------
108 // screen parameters
109 //------------------------------------------------------------------------
111 enum SplashScreenType {
112 splashScreenDispersed,
113 splashScreenClustered,
114 splashScreenStochasticClustered
117 struct SplashScreenParams {
118 SplashScreenType type;
119 int size;
120 int dotRadius;
121 SplashCoord gamma;
122 SplashCoord blackThreshold;
123 SplashCoord whiteThreshold;
126 //------------------------------------------------------------------------
127 // error results
128 //------------------------------------------------------------------------
130 typedef int SplashError;
132 #endif