|
|
|||
File indexing completed on 2025-12-11 10:26:10
0001 //======================================================================== 0002 // 0003 // SplashScreen.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) 2009, 2018, 2020, 2021 Albert Astals Cid <aacid@kde.org> 0015 // 0016 // To see a description of the changes please see the Changelog file that 0017 // came with your tarball or type make ChangeLog if you are building from git 0018 // 0019 //======================================================================== 0020 0021 #ifndef SPLASHSCREEN_H 0022 #define SPLASHSCREEN_H 0023 0024 #include "SplashTypes.h" 0025 0026 #include <cstdlib> 0027 0028 //------------------------------------------------------------------------ 0029 // SplashScreen 0030 //------------------------------------------------------------------------ 0031 0032 class SplashScreen 0033 { 0034 public: 0035 explicit SplashScreen(const SplashScreenParams *params); 0036 explicit SplashScreen(const SplashScreen *screen); 0037 ~SplashScreen(); 0038 0039 SplashScreen(const SplashScreen &) = delete; 0040 SplashScreen &operator=(const SplashScreen &) = delete; 0041 0042 SplashScreen *copy() const { return new SplashScreen(this); } 0043 0044 // Return the computed pixel value (0=black, 1=white) for the gray 0045 // level <value> at (<x>, <y>). 0046 int test(int x, int y, unsigned char value) 0047 { 0048 int xx, yy; 0049 if (mat == nullptr) { 0050 createMatrix(); 0051 } 0052 xx = x & sizeM1; 0053 yy = y & sizeM1; 0054 return value < mat[(yy << log2Size) + xx] ? 0 : 1; 0055 } 0056 0057 // Returns true if value is above the white threshold or below the 0058 // black threshold, i.e., if the corresponding halftone will be 0059 // solid white or black. 0060 bool isStatic(unsigned char value) 0061 { 0062 if (mat == nullptr) { 0063 createMatrix(); 0064 } 0065 return value < minVal || value >= maxVal; 0066 } 0067 0068 private: 0069 void createMatrix(); 0070 0071 void buildDispersedMatrix(int i, int j, int val, int delta, int offset); 0072 void buildClusteredMatrix(); 0073 int distance(int x0, int y0, int x1, int y1); 0074 void buildSCDMatrix(int r); 0075 0076 const SplashScreenParams *screenParams; // params to create the other members 0077 unsigned char *mat; // threshold matrix 0078 int size; // size of the threshold matrix 0079 int sizeM1; // size - 1 0080 int log2Size; // log2(size) 0081 unsigned char minVal; // any pixel value below minVal generates 0082 // solid black 0083 unsigned char maxVal; // any pixel value above maxVal generates 0084 // solid white 0085 }; 0086 0087 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|