beta-0.89.2
[luatex.git] / source / libs / poppler / poppler-src / splash / SplashScreen.h
bloba7fc45591489ec686439af872671582c8fffda16
1 //========================================================================
2 //
3 // SplashScreen.h
4 //
5 //========================================================================
7 //========================================================================
8 //
9 // Modified under the Poppler project - http://poppler.freedesktop.org
11 // All changes made under the Poppler project to this file are licensed
12 // under GPL version 2 or later
14 // Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
16 // To see a description of the changes please see the Changelog file that
17 // came with your tarball or type make ChangeLog if you are building from git
19 //========================================================================
21 #ifndef SPLASHSCREEN_H
22 #define SPLASHSCREEN_H
24 #ifdef USE_GCC_PRAGMAS
25 #pragma interface
26 #endif
28 #include "SplashTypes.h"
30 #include <stdlib.h>
32 //------------------------------------------------------------------------
33 // SplashScreen
34 //------------------------------------------------------------------------
36 class SplashScreen {
37 public:
39 SplashScreen(SplashScreenParams *params);
40 SplashScreen(SplashScreen *screen);
41 ~SplashScreen();
43 SplashScreen *copy() { return new SplashScreen(this); }
45 // Return the computed pixel value (0=black, 1=white) for the gray
46 // level <value> at (<x>, <y>).
47 int test(int x, int y, Guchar value) {
48 int xx, yy;
49 if (mat == NULL) createMatrix();
50 xx = x & sizeM1;
51 yy = y & sizeM1;
52 return value < mat[(yy << log2Size) + xx] ? 0 : 1;
55 // Returns true if value is above the white threshold or below the
56 // black threshold, i.e., if the corresponding halftone will be
57 // solid white or black.
58 GBool isStatic(Guchar value) { if (mat == NULL) createMatrix(); return value < minVal || value >= maxVal; }
60 private:
61 void createMatrix();
63 void buildDispersedMatrix(int i, int j, int val,
64 int delta, int offset);
65 void buildClusteredMatrix();
66 int distance(int x0, int y0, int x1, int y1);
67 void buildSCDMatrix(int r);
69 SplashScreenParams *screenParams; // params to create the other members
70 Guchar *mat; // threshold matrix
71 int size; // size of the threshold matrix
72 int sizeM1; // size - 1
73 int log2Size; // log2(size)
74 Guchar minVal; // any pixel value below minVal generates
75 // solid black
76 Guchar maxVal; // any pixel value above maxVal generates
77 // solid white
80 #endif