SplashTypes.h 4.52 KB
Newer Older
Kristian Høgsberg's avatar
Kristian Høgsberg committed
1 2 3 4 5 6
//========================================================================
//
// SplashTypes.h
//
//========================================================================

7 8 9 10
//========================================================================
//
// Modified under the Poppler project - http://poppler.freedesktop.org
//
11 12 13
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
14
// Copyright (C) 2006 Albert Astals Cid <aacid@kde.org>
15
// Copyright (C) 2008 Tomas Are Haavet <tomasare@gmail.com>
16
// Copyright (C) 2009 Thomas Freitag <Thomas.Freitag@alfa.de>
17 18 19 20 21 22
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
//
//========================================================================

Kristian Høgsberg's avatar
Kristian Høgsberg committed
23 24 25 26 27 28 29 30 31
#ifndef SPLASHTYPES_H
#define SPLASHTYPES_H

#include "goo/gtypes.h"

//------------------------------------------------------------------------
// coordinates
//------------------------------------------------------------------------

32
#if USE_FIXEDPOINT
33
#include "goo/FixedPoint.h"
34 35
typedef FixedPoint SplashCoord;
#else
Kristian Høgsberg's avatar
Kristian Høgsberg committed
36
typedef double SplashCoord;
37
#endif
Kristian Høgsberg's avatar
Kristian Høgsberg committed
38

39 40 41 42 43 44
//------------------------------------------------------------------------
// antialiasing
//------------------------------------------------------------------------

#define splashAASize 4

Kristian Høgsberg's avatar
Kristian Høgsberg committed
45 46 47 48 49
//------------------------------------------------------------------------
// colors
//------------------------------------------------------------------------

enum SplashColorMode {
50 51 52 53 54 55 56
  splashModeMono1,		// 1 bit per component, 8 pixels per byte,
				//   MSbit is on the left
  splashModeMono8,		// 1 byte per component, 1 byte per pixel
  splashModeRGB8,		// 1 byte per component, 3 bytes per pixel:
				//   RGBRGB...
  splashModeBGR8,		// 1 byte per component, 3 bytes per pixel:
				//   BGRBGR...
57
  splashModeXBGR8		// 1 byte per component, 4 bytes per pixel:
58
				//   XBGRXBGR...
59 60
#if SPLASH_CMYK
  ,
61
  splashModeCMYK8		// 1 byte per component, 4 bytes per pixel:
62 63
				//   CMYKCMYK...
#endif
Kristian Høgsberg's avatar
Kristian Høgsberg committed
64 65
};

66 67 68 69
// number of components in each color mode
// (defined in SplashState.cc)
extern int splashColorModeNComps[];

Kristian Høgsberg's avatar
Kristian Høgsberg committed
70
// max number of components in any SplashColor
71
#define splashMaxColorComps 4
Kristian Høgsberg's avatar
Kristian Høgsberg committed
72

73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
typedef Guchar SplashColor[splashMaxColorComps];
typedef Guchar *SplashColorPtr;

// RGB8
static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; }
static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; }
static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; }

// BGR8
static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; }
static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; }
static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; }

#if SPLASH_CMYK
// CMYK8
static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; }
static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; }
static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; }
static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; }
#endif

94 95 96 97 98 99 100 101 102
static inline void splashClearColor(SplashColorPtr dest) {
  dest[0] = 0;
  dest[1] = 0;
  dest[2] = 0;
#if SPLASH_CMYK
  dest[3] = 0;
#endif
}

103 104 105 106 107
static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
  dest[0] = src[0];
  dest[1] = src[1];
  dest[2] = src[2];
#if SPLASH_CMYK
108
  dest[3] = src[3];
109 110 111 112 113 114 115 116
#endif
}

static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) {
  dest[0] ^= src[0];
  dest[1] ^= src[1];
  dest[2] ^= src[2];
#if SPLASH_CMYK
117
  dest[3] ^= src[3];
118 119 120 121 122 123 124 125 126
#endif
}

//------------------------------------------------------------------------
// blend functions
//------------------------------------------------------------------------

typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest,
				SplashColorPtr blend, SplashColorMode cm);
Kristian Høgsberg's avatar
Kristian Høgsberg committed
127

128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
//------------------------------------------------------------------------
// screen parameters
//------------------------------------------------------------------------

enum SplashScreenType {
  splashScreenDispersed,
  splashScreenClustered,
  splashScreenStochasticClustered
};

struct SplashScreenParams {
  SplashScreenType type;
  int size;
  int dotRadius;
  SplashCoord gamma;
  SplashCoord blackThreshold;
  SplashCoord whiteThreshold;
};

Kristian Høgsberg's avatar
Kristian Høgsberg committed
147 148 149 150 151 152 153
//------------------------------------------------------------------------
// error results
//------------------------------------------------------------------------

typedef int SplashError;

#endif