1 | //======================================================================== |
2 | // |
3 | // SplashPattern.h |
4 | // |
5 | //======================================================================== |
6 | |
7 | //======================================================================== |
8 | // |
9 | // Modified under the Poppler project - http://poppler.freedesktop.org |
10 | // |
11 | // All changes made under the Poppler project to this file are licensed |
12 | // under GPL version 2 or later |
13 | // |
14 | // Copyright (C) 2010, 2011, 2014 Thomas Freitag <Thomas.Freitag@alfa.de> |
15 | // Copyright (C) 2018, 2020, 2021 Albert Astals Cid <aacid@kde.org> |
16 | // |
17 | // To see a description of the changes please see the Changelog file that |
18 | // came with your tarball or type make ChangeLog if you are building from git |
19 | // |
20 | //======================================================================== |
21 | |
22 | #ifndef SPLASHPATTERN_H |
23 | #define SPLASHPATTERN_H |
24 | |
25 | #include "SplashTypes.h" |
26 | #include "poppler_private_export.h" |
27 | |
28 | class SplashScreen; |
29 | |
30 | //------------------------------------------------------------------------ |
31 | // SplashPattern |
32 | //------------------------------------------------------------------------ |
33 | |
34 | class POPPLER_PRIVATE_EXPORT SplashPattern |
35 | { |
36 | public: |
37 | SplashPattern(); |
38 | |
39 | virtual SplashPattern *copy() const = 0; |
40 | |
41 | virtual ~SplashPattern(); |
42 | |
43 | SplashPattern(const SplashPattern &) = delete; |
44 | SplashPattern &operator=(const SplashPattern &) = delete; |
45 | |
46 | // Return the color value for a specific pixel. |
47 | virtual bool getColor(int x, int y, SplashColorPtr c) = 0; |
48 | |
49 | // Test if x,y-position is inside pattern. |
50 | virtual bool testPosition(int x, int y) = 0; |
51 | |
52 | // Returns true if this pattern object will return the same color |
53 | // value for all pixels. |
54 | virtual bool isStatic() = 0; |
55 | |
56 | // Returns true if this pattern colorspace is CMYK. |
57 | virtual bool isCMYK() = 0; |
58 | |
59 | private: |
60 | }; |
61 | |
62 | //------------------------------------------------------------------------ |
63 | // SplashSolidColor |
64 | //------------------------------------------------------------------------ |
65 | |
66 | class POPPLER_PRIVATE_EXPORT SplashSolidColor : public SplashPattern |
67 | { |
68 | public: |
69 | explicit SplashSolidColor(SplashColorConstPtr colorA); |
70 | |
71 | SplashPattern *copy() const override { return new SplashSolidColor(color); } |
72 | |
73 | ~SplashSolidColor() override; |
74 | |
75 | bool getColor(int x, int y, SplashColorPtr c) override; |
76 | |
77 | bool testPosition(int x, int y) override { return false; } |
78 | |
79 | bool isStatic() override { return true; } |
80 | |
81 | bool isCMYK() override { return false; } |
82 | |
83 | private: |
84 | SplashColor color; |
85 | }; |
86 | |
87 | //------------------------------------------------------------------------ |
88 | // SplashGouraudColor (needed for gouraudTriangleShadedFill) |
89 | //------------------------------------------------------------------------ |
90 | |
91 | class SplashGouraudColor : public SplashPattern |
92 | { |
93 | public: |
94 | ~SplashGouraudColor() override; |
95 | |
96 | virtual bool isParameterized() = 0; |
97 | |
98 | virtual int getNTriangles() = 0; |
99 | |
100 | virtual void getParametrizedTriangle(int i, double *x0, double *y0, double *color0, double *x1, double *y1, double *color1, double *x2, double *y2, double *color2) = 0; |
101 | |
102 | virtual void getNonParametrizedTriangle(int i, SplashColorMode mode, double *x0, double *y0, SplashColorPtr color0, double *x1, double *y1, SplashColorPtr color1, double *x2, double *y2, SplashColorPtr color2) = 0; |
103 | |
104 | virtual void getParameterizedColor(double t, SplashColorMode mode, SplashColorPtr c) = 0; |
105 | }; |
106 | |
107 | #endif |
108 | |