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