App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
app::TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR > Class Template Reference

`#include <TTransform.hpp>`

## Public Member Functions
| 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

## Detailed Description

### template<typename TPIXEL, typename TCHANNEL, typename TINTERPOLATOR>
class app::TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR >

Definition at line 112 of file TTransform.hpp.

## Constructor & Destructor Documentation

template<typename TPIXEL, typename TCHANNEL, typename TINTERPOLATOR>

app::TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR >::TTransform | ( |  | ) |
| inline

Definition at line 114 of file TTransform.hpp.

{
}
template<typename TPIXEL , typename TCHANNEL , typename TINTERPOLATOR >

TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR >::~TTransform | ( |  | ) |
| virtual

Definition at line 22 of file TTransform.cpp.

{
}

## Member Function Documentation

template<typename TPIXEL , typename TCHANNEL , typename TINTERPOLATOR >

int TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR >::applyMatrix | ( | TBitmap< TPIXEL, TCHANNEL > & | dst,
|  | const TBitmap< TPIXEL, TCHANNEL > & | src,
|  | const Matrix3x3 & | m
| ) |  |
| virtual

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;
Matrix3x3 T = Matrix3x3::inverseOf(m);
double x = 0;
double y = 0;
double factor;
// Potencionalni optimalizace - deleni neni v nekterych pripadech nutne...
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;
return Matrix3x3::transposeOf(m);
}
template<typename TPIXEL, typename TCHANNEL, typename TINTERPOLATOR>

Matrix3x3 app::TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR >::getRotationMatrix | ( | double | alpha | ) |
| inline

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>

Matrix3x3 app::TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR >::getScaleMatrix | ( | double | x,
|  | double | y
| ) |  |
| inline

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>

Matrix3x3 app::TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR >::getShearMatrix | ( | double | x,
|  | double | y
| ) |  |
| inline

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>

Matrix3x3 app::TTransform< TPIXEL, TCHANNEL, TINTERPOLATOR >::getTranslationMatrix | ( | double | dx,
|  | double | dy
| ) |  |
| inline

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