Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 10:26:10

0001 //========================================================================
0002 //
0003 // SplashTypes.h
0004 //
0005 //========================================================================
0006 
0007 //========================================================================
0008 //
0009 // Modified under the Poppler project - http://poppler.freedesktop.org
0010 //
0011 // All changes made under the Poppler project to this file are licensed
0012 // under GPL version 2 or later
0013 //
0014 // Copyright (C) 2006, 2010, 2019, 2020 Albert Astals Cid <aacid@kde.org>
0015 // Copyright (C) 2008 Tomas Are Haavet <tomasare@gmail.com>
0016 // Copyright (C) 2009, 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
0017 // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com>
0018 // Copyright (C) 2010 William Bader <williambader@hotmail.com>
0019 // Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com>
0020 // Copyright (C) 2018 Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.de>
0021 //
0022 // To see a description of the changes please see the Changelog file that
0023 // came with your tarball or type make ChangeLog if you are building from git
0024 //
0025 //========================================================================
0026 
0027 #ifndef SPLASHTYPES_H
0028 #define SPLASHTYPES_H
0029 
0030 #include <cstddef>
0031 
0032 //------------------------------------------------------------------------
0033 // coordinates
0034 //------------------------------------------------------------------------
0035 
0036 #if defined(USE_FLOAT)
0037 typedef float SplashCoord;
0038 #else
0039 typedef double SplashCoord;
0040 #endif
0041 
0042 //------------------------------------------------------------------------
0043 // antialiasing
0044 //------------------------------------------------------------------------
0045 
0046 #define splashAASize 4
0047 
0048 #ifndef SPOT_NCOMPS
0049 #    define SPOT_NCOMPS 4
0050 #endif
0051 
0052 //------------------------------------------------------------------------
0053 // colors
0054 //------------------------------------------------------------------------
0055 
0056 enum SplashColorMode
0057 {
0058     splashModeMono1, // 1 bit per component, 8 pixels per byte,
0059                      //   MSbit is on the left
0060     splashModeMono8, // 1 byte per component, 1 byte per pixel
0061     splashModeRGB8, // 1 byte per component, 3 bytes per pixel:
0062                     //   RGBRGB...
0063     splashModeBGR8, // 1 byte per component, 3 bytes per pixel:
0064                     //   BGRBGR...
0065     splashModeXBGR8, // 1 byte per component, 4 bytes per pixel:
0066                      //   XBGRXBGR...
0067     splashModeCMYK8, // 1 byte per component, 4 bytes per pixel:
0068                      //   CMYKCMYK...
0069     splashModeDeviceN8 // 1 byte per component,
0070                        // 4 bytes + n bytes spot colors per pixel:
0071                        // CMYKSSSSCMYKSSSS...
0072 };
0073 
0074 enum SplashThinLineMode
0075 {
0076     splashThinLineDefault, // if SA on: draw solid if requested line width, transformed into
0077                            // device space, is less than half a pixel and a shaped line else
0078     splashThinLineSolid, // draw line solid at least with 1 pixel
0079     splashThinLineShape // draw line shaped at least with 1 pixel
0080 };
0081 // number of components in each color mode
0082 // (defined in SplashState.cc)
0083 extern int splashColorModeNComps[];
0084 
0085 // max number of components in any SplashColor
0086 constexpr std::size_t splashMaxColorComps = SPOT_NCOMPS + 4;
0087 
0088 typedef unsigned char SplashColor[splashMaxColorComps];
0089 typedef unsigned char *SplashColorPtr;
0090 typedef const unsigned char *SplashColorConstPtr;
0091 
0092 // RGB8
0093 static inline unsigned char splashRGB8R(SplashColorPtr rgb8)
0094 {
0095     return rgb8[0];
0096 }
0097 static inline unsigned char splashRGB8G(SplashColorPtr rgb8)
0098 {
0099     return rgb8[1];
0100 }
0101 static inline unsigned char splashRGB8B(SplashColorPtr rgb8)
0102 {
0103     return rgb8[2];
0104 }
0105 
0106 // BGR8
0107 static inline unsigned char splashBGR8R(SplashColorPtr bgr8)
0108 {
0109     return bgr8[2];
0110 }
0111 static inline unsigned char splashBGR8G(SplashColorPtr bgr8)
0112 {
0113     return bgr8[1];
0114 }
0115 static inline unsigned char splashBGR8B(SplashColorPtr bgr8)
0116 {
0117     return bgr8[0];
0118 }
0119 
0120 // CMYK8
0121 static inline unsigned char splashCMYK8C(SplashColorPtr cmyk8)
0122 {
0123     return cmyk8[0];
0124 }
0125 static inline unsigned char splashCMYK8M(SplashColorPtr cmyk8)
0126 {
0127     return cmyk8[1];
0128 }
0129 static inline unsigned char splashCMYK8Y(SplashColorPtr cmyk8)
0130 {
0131     return cmyk8[2];
0132 }
0133 static inline unsigned char splashCMYK8K(SplashColorPtr cmyk8)
0134 {
0135     return cmyk8[3];
0136 }
0137 
0138 // DEVICEN8
0139 static inline unsigned char splashDeviceN8C(SplashColorPtr deviceN8)
0140 {
0141     return deviceN8[0];
0142 }
0143 static inline unsigned char splashDeviceN8M(SplashColorPtr deviceN8)
0144 {
0145     return deviceN8[1];
0146 }
0147 static inline unsigned char splashDeviceN8Y(SplashColorPtr deviceN8)
0148 {
0149     return deviceN8[2];
0150 }
0151 static inline unsigned char splashDeviceN8K(SplashColorPtr deviceN8)
0152 {
0153     return deviceN8[3];
0154 }
0155 static inline unsigned char splashDeviceN8S(SplashColorPtr deviceN8, int nSpot)
0156 {
0157     return deviceN8[4 + nSpot];
0158 }
0159 
0160 static inline void splashClearColor(SplashColorPtr dest)
0161 {
0162     dest[0] = 0;
0163     dest[1] = 0;
0164     dest[2] = 0;
0165     dest[3] = 0;
0166     for (int i = 4; i < SPOT_NCOMPS + 4; i++) {
0167         dest[i] = 0;
0168     }
0169 }
0170 
0171 static inline void splashColorCopy(SplashColorPtr dest, SplashColorConstPtr src)
0172 {
0173     dest[0] = src[0];
0174     dest[1] = src[1];
0175     dest[2] = src[2];
0176     dest[3] = src[3];
0177     for (int i = 4; i < SPOT_NCOMPS + 4; i++) {
0178         dest[i] = src[i];
0179     }
0180 }
0181 
0182 static inline bool splashColorEqual(SplashColorConstPtr dest, SplashColorConstPtr src)
0183 {
0184     for (int i = 0; i < SPOT_NCOMPS + 4; i++) {
0185         if (dest[i] != src[i]) {
0186             return false;
0187         }
0188     }
0189     return true;
0190 }
0191 
0192 static inline void splashColorXor(SplashColorPtr dest, SplashColorConstPtr src)
0193 {
0194     dest[0] ^= src[0];
0195     dest[1] ^= src[1];
0196     dest[2] ^= src[2];
0197     dest[3] ^= src[3];
0198     for (int i = 4; i < SPOT_NCOMPS + 4; i++) {
0199         dest[i] ^= src[i];
0200     }
0201 }
0202 
0203 //------------------------------------------------------------------------
0204 // blend functions
0205 //------------------------------------------------------------------------
0206 
0207 typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm);
0208 
0209 //------------------------------------------------------------------------
0210 // screen parameters
0211 //------------------------------------------------------------------------
0212 
0213 enum SplashScreenType
0214 {
0215     splashScreenDispersed,
0216     splashScreenClustered,
0217     splashScreenStochasticClustered
0218 };
0219 
0220 struct SplashScreenParams
0221 {
0222     SplashScreenType type;
0223     int size;
0224     int dotRadius;
0225     SplashCoord gamma;
0226     SplashCoord blackThreshold;
0227     SplashCoord whiteThreshold;
0228 };
0229 
0230 //------------------------------------------------------------------------
0231 // error results
0232 //------------------------------------------------------------------------
0233 
0234 typedef int SplashError;
0235 
0236 //------------------------------------------------------------------------
0237 // image file formats
0238 //------------------------------------------------------------------------
0239 
0240 enum SplashImageFileFormat
0241 {
0242     splashFormatJpeg,
0243     splashFormatPng,
0244     splashFormatTiff,
0245     splashFormatJpegCMYK
0246 };
0247 
0248 #endif