~ubuntu-branches/ubuntu/precise/gwenview/precise-proposed

« back to all changes in this revision

Viewing changes to lib/imageutils.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-15 14:17:54 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20111215141754-z043hyx69dulbggf
Tags: upstream-4.7.90
Import upstream version 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// vim: set tabstop=4 shiftwidth=4 noexpandtab:
 
1
// vim: set tabstop=4 shiftwidth=4 expandtab:
2
2
/*
3
3
Gwenview: an image viewer
4
4
Copyright 2007 Aurélien Gâteau <agateau@kde.org>
23
23
// Qt
24
24
#include <QMatrix>
25
25
 
26
 
 
27
 
namespace Gwenview {
28
 
namespace ImageUtils {
29
 
 
30
 
 
31
 
QMatrix transformMatrix(Orientation orientation) {
32
 
        QMatrix matrix;
33
 
        switch (orientation) {
34
 
        case NOT_AVAILABLE:
35
 
        case NORMAL:
36
 
                break;
37
 
 
38
 
        case HFLIP:
39
 
                matrix.scale(-1,1);
40
 
                break;
41
 
 
42
 
        case ROT_180:
43
 
                matrix.rotate(180);
44
 
                break;
45
 
 
46
 
        case VFLIP:
47
 
                matrix.scale(1,-1);
48
 
                break;
49
 
        
50
 
        case TRANSPOSE:
51
 
                matrix.scale(-1,1);
52
 
                matrix.rotate(90);
53
 
                break;
54
 
                
55
 
        case ROT_90:            
56
 
                matrix.rotate(90);
57
 
                break;
58
 
        
59
 
        case TRANSVERSE:
60
 
                matrix.scale(1,-1);
61
 
                matrix.rotate(90);
62
 
                break;
63
 
                
64
 
        case ROT_270:           
65
 
                matrix.rotate(270);
66
 
                break;
67
 
        }
68
 
 
69
 
        return matrix;
 
26
namespace Gwenview
 
27
{
 
28
namespace ImageUtils
 
29
{
 
30
 
 
31
QMatrix transformMatrix(Orientation orientation)
 
32
{
 
33
    QMatrix matrix;
 
34
    switch (orientation) {
 
35
    case NOT_AVAILABLE:
 
36
    case NORMAL:
 
37
        break;
 
38
 
 
39
    case HFLIP:
 
40
        matrix.scale(-1, 1);
 
41
        break;
 
42
 
 
43
    case ROT_180:
 
44
        matrix.rotate(180);
 
45
        break;
 
46
 
 
47
    case VFLIP:
 
48
        matrix.scale(1, -1);
 
49
        break;
 
50
 
 
51
    case TRANSPOSE:
 
52
        matrix.scale(-1, 1);
 
53
        matrix.rotate(90);
 
54
        break;
 
55
 
 
56
    case ROT_90:
 
57
        matrix.rotate(90);
 
58
        break;
 
59
 
 
60
    case TRANSVERSE:
 
61
        matrix.scale(1, -1);
 
62
        matrix.rotate(90);
 
63
        break;
 
64
 
 
65
    case ROT_270:
 
66
        matrix.rotate(270);
 
67
        break;
 
68
    }
 
69
 
 
70
    return matrix;
70
71
}
71
72
 
72
73
} // namespace