QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
28 {
29  public:
32  QgsCubicRasterResampler * clone() const override;
33  void resample( const QImage& srcImage, QImage& dstImage ) override;
34  QString type() const override { return "cubic"; }
35 
36  private:
37  static void xDerivativeMatrix( int nCols, int nRows, double* matrix, const int* colorMatrix );
38  static void yDerivativeMatrix( int nCols, int nRows, double* matrix, const int* colorMatrix );
39 
40  void calculateControlPoints( int nCols, int nRows, int currentRow, int currentCol, int* redMatrix, int* greenMatrix, int* blueMatrix,
41  int* alphaMatrix, double* xDerivativeMatrixRed, double* xDerivativeMatrixGreen, double* xDerivativeMatrixBlue,
42  double* xDerivativeMatrixAlpha, double* yDerivativeMatrixRed, double* yDerivativeMatrixGreen, double* yDerivativeMatrixBlue,
43  double* yDerivativeMatrixAlpha );
44 
46  QRgb curveInterpolation( QRgb pt1, QRgb pt2, double t, double d1red, double d1green, double d1blue, double d1alpha, double d2red, double d2green,
47  double d2blue, double d2alpha );
48 
49  static inline double calcBernsteinPolyN3( int i, double t );
50  static inline int lowerN3( int i );
51 
52  //creates a QRgb by applying bounds checks
53  static inline QRgb createPremultipliedColor( const int r, const int g, const int b, const int a );
54 
55  //control points
56 
57  //red
58  double cRed00;
59  double cRed10;
60  double cRed20;
61  double cRed30;
62  double cRed01;
63  double cRed11;
64  double cRed21;
65  double cRed31;
66  double cRed02;
67  double cRed12;
68  double cRed22;
69  double cRed32;
70  double cRed03;
71  double cRed13;
72  double cRed23;
73  double cRed33;
74  //green
75  double cGreen00;
76  double cGreen10;
77  double cGreen20;
78  double cGreen30;
79  double cGreen01;
80  double cGreen11;
81  double cGreen21;
82  double cGreen31;
83  double cGreen02;
84  double cGreen12;
85  double cGreen22;
86  double cGreen32;
87  double cGreen03;
88  double cGreen13;
89  double cGreen23;
90  double cGreen33;
91  //blue
92  double cBlue00;
93  double cBlue10;
94  double cBlue20;
95  double cBlue30;
96  double cBlue01;
97  double cBlue11;
98  double cBlue21;
99  double cBlue31;
100  double cBlue02;
101  double cBlue12;
102  double cBlue22;
103  double cBlue32;
104  double cBlue03;
105  double cBlue13;
106  double cBlue23;
107  double cBlue33;
108  //alpha
109  double cAlpha00;
110  double cAlpha10;
111  double cAlpha20;
112  double cAlpha30;
113  double cAlpha01;
114  double cAlpha11;
115  double cAlpha21;
116  double cAlpha31;
117  double cAlpha02;
118  double cAlpha12;
119  double cAlpha22;
120  double cAlpha32;
121  double cAlpha03;
122  double cAlpha13;
123  double cAlpha23;
124  double cAlpha33;
125 
126 
127 };
128 
129 #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
QString type() const override