#include <TTransform.hpp>
|
| TTransform () |
|
virtual | ~TTransform () |
|
virtual int | applyMatrix (TBitmap< TPIXEL, TCHANNEL > &dst, const TBitmap< TPIXEL, TCHANNEL > &src, const Matrix3x3 &m) |
|
Matrix3x3 | getTranslationMatrix (double dx, double dy) |
|
Matrix3x3 | getRotationMatrix (double alpha) |
|
Matrix3x3 | getScaleMatrix (double x, double y) |
|
Matrix3x3 | getShearMatrix (double x, double y) |
|
Matrix3x3 | getProjectiveMatrix (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) |
| vrátí matici transformující jednotkový čtverec na daný čtyřúhelník
|
|
template<typename TPIXEL, typename TCHANNEL, typename TINTERPOLATOR>
class app::TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR >
Definition at line 112 of file TTransform.hpp.
template<typename TPIXEL, typename TCHANNEL, typename TINTERPOLATOR>
template<typename TPIXEL , typename TCHANNEL , typename TINTERPOLATOR >
template<typename TPIXEL , typename TCHANNEL , typename TINTERPOLATOR >
Definition at line 27 of file TTransform.cpp.
{
TPIXEL * const srcData = src.getData();
if (srcData == NULL) {
return 1;
}
TPIXEL * const dstData = dst.getData();
if (dstData == NULL) {
return 2;
}
TINTERPOLATOR i(src);
if (!i.isInitOk()) {
return 3;
}
TPIXEL * dPtr = dstData;
int dstWidth = dst.getWidth();
int dstHeight = dst.getHeight();
TPIXEL * dPtrRowEnd = dstData + dstWidth;
TPIXEL * dPtrEnd = dstData + dstWidth * dstHeight;
double x = 0;
double y = 0;
double factor;
y = 0.5;
while (dPtr < dPtrEnd) {
x = 0.5;
while (dPtr < dPtrRowEnd) {
factor = 1 / (T.a13 * x + T.a23 * y + T.a33);
*dPtr = i.getAt((x * T.a11 + y * T.a21 + T.a31) * factor, (x * T.a12 + y * T.a22 + T.a32) * factor);
dPtr++;
x += 1;
}
dPtrRowEnd += dstWidth;
y += 1;
}
return 0;
}
template<typename TPIXEL, typename TCHANNEL, typename TINTERPOLATOR>
Matrix3x3 app::TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR >::getProjectiveMatrix |
( |
double |
x1, |
|
|
double |
y1, |
|
|
double |
x2, |
|
|
double |
y2, |
|
|
double |
x3, |
|
|
double |
y3, |
|
|
double |
x4, |
|
|
double |
y4 |
|
) |
| |
|
inline |
vrátí matici transformující jednotkový čtverec na daný čtyřúhelník
- Returns
Definition at line 151 of file TTransform.hpp.
{
Matrix3x3 m;
m.a31 = ((x1 - x2 + x4 - x3) * (y3 - y4) - (y1 - y2 + y4 - y3) * (x3 - x4)) / ((x2 - x4) * (y3 - y4) - (x3 - x4) * (y2 - y4));
m.a32 = ((y1 - y2 + y4 - y3) * (x2 - x4) - (x1 - x2 + x4 - x3) * (y2 - y4)) / ((x2 - x4) * (y3 - y4) - (x3 - x4) * (y2 - y4));
m.a11 = x2 - x1 + m.a31 * x2;
m.a12 = x3 - x1 + m.a32 * x3;
m.a13 = x1;
m.a21 = y2 - y1 + m.a31 * y2;
m.a22 = y3 - y1 + m.a32 * y3;
m.a23 = y1;
m.a33 = 1;
}
template<typename TPIXEL, typename TCHANNEL, typename TINTERPOLATOR>
Definition at line 128 of file TTransform.hpp.
{
return Matrix3x3( cos(alpha), sin(alpha), 0,
-sin(alpha), cos(alpha), 0,
0, 0, 1);
}
template<typename TPIXEL, typename TCHANNEL, typename TINTERPOLATOR>
Definition at line 134 of file TTransform.hpp.
{
return Matrix3x3( x, 0, 0,
0, y, 0,
0, 0, 1);
}
template<typename TPIXEL, typename TCHANNEL, typename TINTERPOLATOR>
Definition at line 140 of file TTransform.hpp.
{
return Matrix3x3( 1, y, 0,
x, 1, 0,
0, 0, 1);
}
template<typename TPIXEL, typename TCHANNEL, typename TINTERPOLATOR>
Definition at line 122 of file TTransform.hpp.
{
return Matrix3x3( 1, 0, 0,
0, 1, 0,
dx, dy, 1);
}
The documentation for this class was generated from the following files:
- /home/xxx/eclipse_workspaces/app/appcore/jni/app/transform_new/TTransform.hpp
- /home/xxx/eclipse_workspaces/app/appcore/jni/app/transform_new/TTransform.cpp