| 1 |
//======================================================================== |
| 2 |
// |
| 3 |
// SplashTypes.h |
| 4 |
// |
| 5 |
// Copyright 2003-2013 Glyph & Cog, LLC |
| 6 |
// |
| 7 |
//======================================================================== |
| 8 |
|
| 9 |
#ifndef SPLASHTYPES_H |
| 10 |
#define SPLASHTYPES_H |
| 11 |
|
| 12 |
#include <aconf.h> |
| 13 |
#include "gtypes.h" |
| 14 |
|
| 15 |
//------------------------------------------------------------------------ |
| 16 |
// coordinates |
| 17 |
//------------------------------------------------------------------------ |
| 18 |
|
| 19 |
#if USE_FIXEDPOINT |
| 20 |
#include "FixedPoint.h" |
| 21 |
typedef FixedPoint SplashCoord; |
| 22 |
#else |
| 23 |
typedef double SplashCoord; |
| 24 |
#endif |
| 25 |
|
| 26 |
//------------------------------------------------------------------------ |
| 27 |
// antialiasing |
| 28 |
//------------------------------------------------------------------------ |
| 29 |
|
| 30 |
#define splashAASize 4 |
| 31 |
|
| 32 |
//------------------------------------------------------------------------ |
| 33 |
// colors |
| 34 |
//------------------------------------------------------------------------ |
| 35 |
|
| 36 |
enum SplashColorMode { |
| 37 |
splashModeMono1, // 1 bit per component, 8 pixels per byte, |
| 38 |
// MSbit is on the left |
| 39 |
splashModeMono8, // 1 byte per component, 1 byte per pixel |
| 40 |
splashModeRGB8, // 1 byte per component, 3 bytes per pixel: |
| 41 |
// RGBRGB... |
| 42 |
splashModeBGR8 // 1 byte per component, 3 bytes per pixel: |
| 43 |
// BGRBGR... |
| 44 |
|
| 45 |
#if SPLASH_CMYK |
| 46 |
, |
| 47 |
splashModeCMYK8 // 1 byte per component, 4 bytes per pixel: |
| 48 |
// CMYKCMYK... |
| 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 |
#define splashMaxColorComps 3 |
| 58 |
#if SPLASH_CMYK |
| 59 |
# undef splashMaxColorComps |
| 60 |
# define splashMaxColorComps 4 |
| 61 |
#endif |
| 62 |
|
| 63 |
typedef Guchar SplashColor[splashMaxColorComps]; |
| 64 |
typedef Guchar *SplashColorPtr; |
| 65 |
|
| 66 |
// RGB8 |
| 67 |
static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; } |
| 68 |
static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; } |
| 69 |
static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; } |
| 70 |
|
| 71 |
// BGR8 |
| 72 |
static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; } |
| 73 |
static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; } |
| 74 |
static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; } |
| 75 |
|
| 76 |
#if SPLASH_CMYK |
| 77 |
// CMYK8 |
| 78 |
static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; } |
| 79 |
static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; } |
| 80 |
static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; } |
| 81 |
static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; } |
| 82 |
#endif |
| 83 |
|
| 84 |
static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) { |
| 85 |
dest[0] = src[0]; |
| 86 |
dest[1] = src[1]; |
| 87 |
dest[2] = src[2]; |
| 88 |
#if SPLASH_CMYK |
| 89 |
dest[3] = src[3]; |
| 90 |
#endif |
| 91 |
} |
| 92 |
|
| 93 |
static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) { |
| 94 |
dest[0] ^= src[0]; |
| 95 |
dest[1] ^= src[1]; |
| 96 |
dest[2] ^= src[2]; |
| 97 |
#if SPLASH_CMYK |
| 98 |
dest[3] ^= src[3]; |
| 99 |
#endif |
| 100 |
} |
| 101 |
|
| 102 |
//------------------------------------------------------------------------ |
| 103 |
// blend functions |
| 104 |
//------------------------------------------------------------------------ |
| 105 |
|
| 106 |
typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest, |
| 107 |
SplashColorPtr blend, SplashColorMode cm); |
| 108 |
|
| 109 |
//------------------------------------------------------------------------ |
| 110 |
// stroke adjustment mode |
| 111 |
//------------------------------------------------------------------------ |
| 112 |
|
| 113 |
enum SplashStrokeAdjustMode { |
| 114 |
splashStrokeAdjustOff, |
| 115 |
splashStrokeAdjustNormal, |
| 116 |
splashStrokeAdjustCAD |
| 117 |
}; |
| 118 |
|
| 119 |
//------------------------------------------------------------------------ |
| 120 |
// screen parameters |
| 121 |
//------------------------------------------------------------------------ |
| 122 |
|
| 123 |
enum SplashScreenType { |
| 124 |
splashScreenDispersed, |
| 125 |
splashScreenClustered, |
| 126 |
splashScreenStochasticClustered |
| 127 |
}; |
| 128 |
|
| 129 |
struct SplashScreenParams { |
| 130 |
SplashScreenType type; |
| 131 |
int size; |
| 132 |
int dotRadius; |
| 133 |
SplashCoord gamma; |
| 134 |
SplashCoord blackThreshold; |
| 135 |
SplashCoord whiteThreshold; |
| 136 |
}; |
| 137 |
|
| 138 |
//------------------------------------------------------------------------ |
| 139 |
// error results |
| 140 |
//------------------------------------------------------------------------ |
| 141 |
|
| 142 |
typedef int SplashError; |
| 143 |
|
| 144 |
|
| 145 |
#endif |