"Fossies" - the Fresh Open Source Software Archive

Member "xpdf-4.02/splash/SplashScreen.h" (25 Sep 2019, 2167 Bytes) of package /linux/misc/xpdf-4.02.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "SplashScreen.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 3.04_vs_4.00.

    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 typedef Guchar *SplashScreenCursor;
   25 
   26 class SplashScreen {
   27 public:
   28 
   29   SplashScreen(SplashScreenParams *params);
   30   SplashScreen(SplashScreen *screen);
   31   ~SplashScreen();
   32 
   33   SplashScreen *copy() { return new SplashScreen(this); }
   34 
   35   // Return the computed pixel value (0=black, 1=white) for the gray
   36   // level <value> at (<x>, <y>).
   37   int test(int x, int y, Guchar value) {
   38     int xx, yy;
   39     xx = x & sizeM1;
   40     yy = y & sizeM1;
   41     return value < mat[(yy << log2Size) + xx] ? 0 : 1;
   42   }
   43 
   44   // To do a series of tests with the same y value, call
   45   // getTestCursor(y), and then call testWithCursor(cursor, x, value)
   46   // for each x.
   47   SplashScreenCursor getTestCursor(int y) {
   48     int yy;
   49     yy = y & sizeM1;
   50     return &mat[yy << log2Size];
   51   }
   52 
   53   int testWithCursor(SplashScreenCursor cursor, int x, Guchar value) {
   54     int xx = x & sizeM1;
   55     return value >= cursor[xx];
   56   }
   57 
   58   // Returns true if value is above the white threshold or below the
   59   // black threshold, i.e., if the corresponding halftone will be
   60   // solid white or black.
   61   GBool isStatic(Guchar value) { return value < minVal || value >= maxVal; }
   62 
   63 private:
   64 
   65   void buildDispersedMatrix(int i, int j, int val,
   66                 int delta, int offset);
   67   void buildClusteredMatrix();
   68   int distance(int x0, int y0, int x1, int y1);
   69   void buildSCDMatrix(int r);
   70 
   71   Guchar *mat;          // threshold matrix
   72   int size;         // size of the threshold matrix
   73   int sizeM1;           // size - 1
   74   int log2Size;         // log2(size)
   75   Guchar minVal;        // any pixel value below minVal generates
   76                 //   solid black
   77   Guchar maxVal;        // any pixel value above maxVal generates
   78                 //   solid white
   79 };
   80 
   81 #endif