QGIS API Documentation  2.4.0-Chugiak
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  QgsRasterResampler * clone() const;
33  void resample( const QImage& srcImage, QImage& dstImage );
34  QString type() const { 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 double calcBernsteinPoly( int n, int i, double t );
50  static int lower( int n, int i );
51  static double power( double a, int b );//calculates a power b
52  static int faculty( int n );
53 
54  //control points
55 
56  //red
57  double cRed00; double cRed10; double cRed20; double cRed30; double cRed01; double cRed11; double cRed21; double cRed31;
58  double cRed02; double cRed12; double cRed22; double cRed32; double cRed03; double cRed13; double cRed23; double cRed33;
59  //green
60  double cGreen00; double cGreen10; double cGreen20; double cGreen30; double cGreen01; double cGreen11; double cGreen21; double cGreen31;
61  double cGreen02; double cGreen12; double cGreen22; double cGreen32; double cGreen03; double cGreen13; double cGreen23; double cGreen33;
62  //blue
63  double cBlue00; double cBlue10; double cBlue20; double cBlue30; double cBlue01; double cBlue11; double cBlue21; double cBlue31;
64  double cBlue02; double cBlue12; double cBlue22; double cBlue32; double cBlue03; double cBlue13; double cBlue23; double cBlue33;
65  //alpha
66  double cAlpha00; double cAlpha10; double cAlpha20; double cAlpha30; double cAlpha01; double cAlpha11; double cAlpha21; double cAlpha31;
67  double cAlpha02; double cAlpha12; double cAlpha22; double cAlpha32; double cAlpha03; double cAlpha13; double cAlpha23; double cAlpha33;
68 };
69 
70 #endif // QGSCUBICRASTERRESAMPLER_H
Cubic Raster Resampler.
Interface for resampling rasters (e.g.
virtual void resample(const QImage &srcImage, QImage &dstImage)=0
int ANALYSIS_EXPORT faculty(int n)
faculty function
double ANALYSIS_EXPORT power(double a, int b)
power function for integer coefficients
int ANALYSIS_EXPORT lower(int n, int i)
lower function
virtual QgsRasterResampler * clone() const =0
double ANALYSIS_EXPORT calcBernsteinPoly(int n, int i, double t)
calculates the value of a Bernstein polynomial