QGIS API Documentation  2.99.0-Master (a18066b)
qgscubicrasterresampler.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscubicrasterresampler.h
3  ----------------------------
4  begin : December 2011
5  copyright : (C) 2011 by Marco Hugentobler
6  email : marco at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSCUBICRASTERRESAMPLER_H
19 #define QGSCUBICRASTERRESAMPLER_H
20 
21 #include "qgsrasterresampler.h"
22 #include <QColor>
23 
24 #include "qgis_core.h"
25 
30 {
31  public:
33  QgsCubicRasterResampler * clone() const override;
34  void resample( const QImage& srcImage, QImage& dstImage ) override;
35  QString type() const override { return QStringLiteral( "cubic" ); }
36 
37  private:
38  static void xDerivativeMatrix( int nCols, int nRows, double* matrix, const int* colorMatrix );
39  static void yDerivativeMatrix( int nCols, int nRows, double* matrix, const int* colorMatrix );
40 
41  void calculateControlPoints( int nCols, int nRows, int currentRow, int currentCol, int* redMatrix, int* greenMatrix, int* blueMatrix,
42  int* alphaMatrix, double* xDerivativeMatrixRed, double* xDerivativeMatrixGreen, double* xDerivativeMatrixBlue,
43  double* xDerivativeMatrixAlpha, double* yDerivativeMatrixRed, double* yDerivativeMatrixGreen, double* yDerivativeMatrixBlue,
44  double* yDerivativeMatrixAlpha );
45 
47  QRgb curveInterpolation( QRgb pt1, QRgb pt2, double t, double d1red, double d1green, double d1blue, double d1alpha, double d2red, double d2green,
48  double d2blue, double d2alpha );
49 
50  static inline double calcBernsteinPolyN3( int i, double t );
51  static inline int lowerN3( int i );
52 
53  //creates a QRgb by applying bounds checks
54  static inline QRgb createPremultipliedColor( const int r, const int g, const int b, const int a );
55 
56  //control points
57 
58  //red
59  double cRed00;
60  double cRed10;
61  double cRed20;
62  double cRed30;
63  double cRed01;
64  double cRed11;
65  double cRed21;
66  double cRed31;
67  double cRed02;
68  double cRed12;
69  double cRed22;
70  double cRed32;
71  double cRed03;
72  double cRed13;
73  double cRed23;
74  double cRed33;
75  //green
76  double cGreen00;
77  double cGreen10;
78  double cGreen20;
79  double cGreen30;
80  double cGreen01;
81  double cGreen11;
82  double cGreen21;
83  double cGreen31;
84  double cGreen02;
85  double cGreen12;
86  double cGreen22;
87  double cGreen32;
88  double cGreen03;
89  double cGreen13;
90  double cGreen23;
91  double cGreen33;
92  //blue
93  double cBlue00;
94  double cBlue10;
95  double cBlue20;
96  double cBlue30;
97  double cBlue01;
98  double cBlue11;
99  double cBlue21;
100  double cBlue31;
101  double cBlue02;
102  double cBlue12;
103  double cBlue22;
104  double cBlue32;
105  double cBlue03;
106  double cBlue13;
107  double cBlue23;
108  double cBlue33;
109  //alpha
110  double cAlpha00;
111  double cAlpha10;
112  double cAlpha20;
113  double cAlpha30;
114  double cAlpha01;
115  double cAlpha11;
116  double cAlpha21;
117  double cAlpha31;
118  double cAlpha02;
119  double cAlpha12;
120  double cAlpha22;
121  double cAlpha32;
122  double cAlpha03;
123  double cAlpha13;
124  double cAlpha23;
125  double cAlpha33;
126 
127 
128 };
129 
130 #endif // QGSCUBICRASTERRESAMPLER_H
Cubic Raster Resampler.
Interface for resampling rasters (e.g.
virtual void resample(const QImage &srcImage, QImage &dstImage)=0
virtual QgsRasterResampler * clone() const =0
Get a deep copy of this object.
QString type() const override
Get a descriptive type identifier for this raster resampler.