1 //======================================================================== 2 // 3 // SplashScreen.h 4 // 5 // Copyright 2003-2013 Glyph & Cog, LLC 6 // 7 //======================================================================== 8 9 #ifndef SPLASHSCREEN_H 10 #define SPLASHSCREEN_H 11 12 #include <aconf.h> 13 14 #ifdef USE_GCC_PRAGMAS 15 #pragma interface 16 #endif 17 18 #include "SplashTypes.h" 19 20 //------------------------------------------------------------------------ 21 // SplashScreen 22 //------------------------------------------------------------------------ 23 24 class SplashScreen { 25 public: 26 27 SplashScreen(SplashScreenParams *params); 28 SplashScreen(SplashScreen *screen); 29 ~SplashScreen(); 30 copy()31 SplashScreen *copy() { return new SplashScreen(this); } 32 33 // Return the computed pixel value (0=black, 1=white) for the gray 34 // level <value> at (<x>, <y>). test(int x,int y,Guchar value)35 int test(int x, int y, Guchar value) { 36 int xx, yy; 37 xx = x & sizeM1; 38 yy = y & sizeM1; 39 return value < mat[(yy << log2Size) + xx] ? 0 : 1; 40 } 41 42 // Returns true if value is above the white threshold or below the 43 // black threshold, i.e., if the corresponding halftone will be 44 // solid white or black. isStatic(Guchar value)45 GBool isStatic(Guchar value) { return value < minVal || value >= maxVal; } 46 47 private: 48 49 void buildDispersedMatrix(int i, int j, int val, 50 int delta, int offset); 51 void buildClusteredMatrix(); 52 int distance(int x0, int y0, int x1, int y1); 53 void buildSCDMatrix(int r); 54 55 Guchar *mat; // threshold matrix 56 int size; // size of the threshold matrix 57 int sizeM1; // size - 1 58 int log2Size; // log2(size) 59 Guchar minVal; // any pixel value below minVal generates 60 // solid black 61 Guchar maxVal; // any pixel value above maxVal generates 62 // solid white 63 }; 64 65 #endif 66