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