KExiv2Iface::Matrix
Functions | |
RotationMatrix | matrix (KExiv2::ImageOrientation exifOrientation) |
RotationMatrix | matrix (RotationMatrix::TransformationAction action) |
Variables | |
static const RotationMatrix | flipHorizontal (-1, 0, 0, 1) |
static const RotationMatrix | flipVertical (1, 0, 0, -1) |
static const RotationMatrix | identity (1, 0, 0, 1) |
static const RotationMatrix | rotate180 (-1, 0, 0, -1) |
static const RotationMatrix | rotate270 (0, -1, 1, 0) |
static const RotationMatrix | rotate90 (0, 1, -1, 0) |
static const RotationMatrix | rotate90flipHorizontal (0, 1, 1, 0) |
static const RotationMatrix | rotate90flipVertical (0, -1, -1, 0) |
Detailed Description
If the picture is displayed according to the exif orientation tag, the user will request rotating operations relative to what he sees, and that is the picture rotated according to the EXIF tag.
So the operation requested and the given EXIF angle must be combined. E.g. if orientation is "6" (rotate 90 clockwiseto show correctly) and the user selects 180 clockwise, the operation is 270. If the user selected 270, the operation would be None (and clearing the exif tag).
This requires to describe the transformations in a model which cares for both composing (180+90=270) and eliminating (180+180=no action), as well as the non-commutative nature of the operations (vflip+90 is not 90+vflip)
All 2D transformations can be described by a 2x3 matrix, see QWRotationMatrix. All transformations needed here - rotate 90, 180, 270, flipV, flipH - can be described in a 2x2 matrix with the values 0,1,-1 (because flipping is expressed by changing the sign only, and sine and cosine of 90, 180 and 270 are either 0,1 or -1).
x' = m11 x + m12 y y' = m21 x + m22 y
Moreover, all combinations of these rotate/flip operations result in one of the eight matrices defined below. (I did not proof that mathematically, but empirically)
static const RotationMatrix identity; //( 1, 0, 0, 1) static const RotationMatrix rotate90; //( 0, 1, -1, 0) static const RotationMatrix rotate180; //(-1, 0, 0, -1) static const RotationMatrix rotate270; //( 0, -1, 1, 0) static const RotationMatrix flipHorizontal; //(-1, 0, 0, 1) static const RotationMatrix flipVertical; //( 1, 0, 0, -1) static const RotationMatrix rotate90flipHorizontal; //( 0, 1, 1, 0), first rotate, then flip static const RotationMatrix rotate90flipVertical; //( 0, -1, -1, 0), first rotate, then flip
Function Documentation
◆ matrix() [1/2]
RotationMatrix KExiv2Iface::Matrix::matrix | ( | KExiv2::ImageOrientation | exifOrientation | ) |
Definition at line 85 of file rotationmatrix.cpp.
◆ matrix() [2/2]
RotationMatrix KExiv2Iface::Matrix::matrix | ( | RotationMatrix::TransformationAction | action | ) |
Definition at line 64 of file rotationmatrix.cpp.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:12:07 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.