|
Quantum GIS API Documentation
master-ce49b66
|
00001 /*************************************************************************** 00002 qgscubicrasterresampler.h 00003 ---------------------------- 00004 begin : December 2011 00005 copyright : (C) 2011 by Marco Hugentobler 00006 email : marco at sourcepole dot ch 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef QGSCUBICRASTERRESAMPLER_H 00019 #define QGSCUBICRASTERRESAMPLER_H 00020 00021 #include "qgsrasterresampler.h" 00022 #include <QColor> 00023 00027 class CORE_EXPORT QgsCubicRasterResampler: public QgsRasterResampler 00028 { 00029 public: 00030 QgsCubicRasterResampler(); 00031 ~QgsCubicRasterResampler(); 00032 QgsRasterResampler * clone() const; 00033 void resample( const QImage& srcImage, QImage& dstImage ); 00034 QString type() const { return "cubic"; } 00035 00036 private: 00037 static void xDerivativeMatrix( int nCols, int nRows, double* matrix, const int* colorMatrix ); 00038 static void yDerivativeMatrix( int nCols, int nRows, double* matrix, const int* colorMatrix ); 00039 00040 void calculateControlPoints( int nCols, int nRows, int currentRow, int currentCol, int* redMatrix, int* greenMatrix, int* blueMatrix, 00041 int* alphaMatrix, double* xDerivativeMatrixRed, double* xDerivativeMatrixGreen, double* xDerivativeMatrixBlue, 00042 double* xDerivativeMatrixAlpha, double* yDerivativeMatrixRed, double* yDerivativeMatrixGreen, double* yDerivativeMatrixBlue, 00043 double* yDerivativeMatrixAlpha ); 00044 00046 QRgb curveInterpolation( QRgb pt1, QRgb pt2, double t, double d1red, double d1green, double d1blue, double d1alpha, double d2red, double d2green, 00047 double d2blue, double d2alpha ); 00048 00049 static double calcBernsteinPoly( int n, int i, double t ); 00050 static int lower( int n, int i ); 00051 static double power( double a, int b );//calculates a power b 00052 static int faculty( int n ); 00053 00054 //control points 00055 00056 //red 00057 double cRed00; double cRed10; double cRed20; double cRed30; double cRed01; double cRed11; double cRed21; double cRed31; 00058 double cRed02; double cRed12; double cRed22; double cRed32; double cRed03; double cRed13; double cRed23; double cRed33; 00059 //green 00060 double cGreen00; double cGreen10; double cGreen20; double cGreen30; double cGreen01; double cGreen11; double cGreen21; double cGreen31; 00061 double cGreen02; double cGreen12; double cGreen22; double cGreen32; double cGreen03; double cGreen13; double cGreen23; double cGreen33; 00062 //blue 00063 double cBlue00; double cBlue10; double cBlue20; double cBlue30; double cBlue01; double cBlue11; double cBlue21; double cBlue31; 00064 double cBlue02; double cBlue12; double cBlue22; double cBlue32; double cBlue03; double cBlue13; double cBlue23; double cBlue33; 00065 //alpha 00066 double cAlpha00; double cAlpha10; double cAlpha20; double cAlpha30; double cAlpha01; double cAlpha11; double cAlpha21; double cAlpha31; 00067 double cAlpha02; double cAlpha12; double cAlpha22; double cAlpha32; double cAlpha03; double cAlpha13; double cAlpha23; double cAlpha33; 00068 }; 00069 00070 #endif // QGSCUBICRASTERRESAMPLER_H