1
/* ============================================================
3
* This file is a part of kipi-plugins project
4
* http://www.kipi-plugins.org
7
* Description : Tools for combining rotation operations
9
* Copyright (C) 2004-2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10
* Copyright (C) 2006-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
12
* This program is free software; you can redistribute it
13
* and/or modify it under the terms of the GNU General
14
* Public License as published by the Free Software Foundation;
15
* either version 2, or (at your option) any later version.
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* ============================================================ */
24
#ifndef LIBKEXIV2_ROTATIONMATRIX_H
25
#define LIBKEXIV2_ROTATIONMATRIX_H
39
/** This describes single transform primitives.
40
* Note some of the defined Exif rotation flags combine
41
* two of these actions.
42
* The enum values correspond to those defined
43
* as JXFORM_CODE in the often used the JPEG tool transupp.h.
45
enum TransformationAction
47
NoTransformation = 0,/// no transformation
48
FlipHorizontal = 1, /// horizontal flip
49
FlipVertical = 2, /// vertical flip
50
Rotate90 = 5, /// 90-degree clockwise rotation
51
Rotate180 = 6, /// 180-degree rotation
52
Rotate270 = 7 /// 270-degree clockwise (or 90 ccw)
55
/// Constructs the identity matrix (the matrix describing no transformation)
57
/// Returns the matrix corresponding to the given TransformationAction
58
RotationMatrix(TransformationAction action);
59
/// Returns the matrix corresponding to the given TransformationAction
60
RotationMatrix(KExiv2Iface::KExiv2::ImageOrientation exifOrientation);
62
bool operator==(const RotationMatrix &ma) const;
63
bool operator!=(const RotationMatrix &ma) const;
65
/// Returns true of this matrix describes no transformation (is the identity matrix)
66
bool isNoTransform() const;
68
RotationMatrix &operator*=(const RotationMatrix &ma);
70
/// Applies the given transform to this matrix
71
RotationMatrix &operator*=(TransformationAction action);
73
/// Applies the given transform actions to this matrix
74
RotationMatrix &operator*=(QList<TransformationAction> actions);
76
/// Applies the given Exif orientation flag to this matrix
77
RotationMatrix &operator*=(KExiv2Iface::KExiv2::ImageOrientation exifOrientation);
79
/** Returns the actions described by this matrix. The order matters.
80
* Not all possible matrices are supported, but all those that can be combined
81
* by Exif rotation flags and the transform actions above.
82
* If isNoTransform() or the matrix is not supported returns an empty list. */
83
QList<TransformationAction> transformations() const;
85
/** Returns the Exif orienation flag describing this matrix.
86
* Returns ORIENTATION_UNSPECIFIED if no flag matches this matrix.
88
KExiv2Iface::KExiv2::ImageOrientation exifOrientation() const;
90
RotationMatrix(int m11, int m12, int m21, int m22);
94
void set(int m11, int m12, int m21, int m22);
99
} // namespace KExiv2Iface
101
#endif // LIBKEXIV2_ROTATIONMATRIX_H