libkipi from trunk (KDE 4.3) : add support of kipi host settings "file timestamp...
[kdegraphics.git] / gwenview / lib / imageutils.cpp
blob7dde54ffd3f840cd4b9693d27215320a5926e867
1 // vim: set tabstop=4 shiftwidth=4 noexpandtab:
2 /*
3 Gwenview: an image viewer
4 Copyright 2007 Aurélien Gâteau <aurelien.gateau@free.fr>
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "imageutils.h"
23 // Qt
24 #include <QMatrix>
27 namespace Gwenview {
28 namespace ImageUtils {
31 QMatrix transformMatrix(Orientation orientation) {
32 QMatrix matrix;
33 switch (orientation) {
34 case NOT_AVAILABLE:
35 case NORMAL:
36 break;
38 case HFLIP:
39 matrix.scale(-1,1);
40 break;
42 case ROT_180:
43 matrix.rotate(180);
44 break;
46 case VFLIP:
47 matrix.scale(1,-1);
48 break;
50 case TRANSPOSE:
51 matrix.scale(-1,1);
52 matrix.rotate(90);
53 break;
55 case ROT_90:
56 matrix.rotate(90);
57 break;
59 case TRANSVERSE:
60 matrix.scale(1,-1);
61 matrix.rotate(90);
62 break;
64 case ROT_270:
65 matrix.rotate(270);
66 break;
69 return matrix;
72 } // namespace
73 } // namespace