KExiv2Iface::Matrix

KExiv2Iface::Matrix Namespace Reference

Functions

RotationMatrix matrix (RotationMatrix::TransformationAction action)
 
RotationMatrix matrix (KExiv2::ImageOrientation exifOrientation)
 

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

This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Nov 26 2020 22:35:13 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.