~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to tests/pgfscaled.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of kipi-plugins project
 
4
 * http://www.kipi-plugins.org
 
5
 *
 
6
 * Date        : 2009-02-04
 
7
 * Description : a command line tool to test PGF scaled to QImage
 
8
 *
 
9
 * Copyright (C) 2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 *
 
11
 * This program is free software; you can redistribute it
 
12
 * and/or modify it under the terms of the GNU General
 
13
 * Public License as published by the Free Software Foundation;
 
14
 * either version 2, or (at your option) any later version.
 
15
 *
 
16
 * This program is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 * GNU General Public License for more details.
 
20
 *
 
21
 * ============================================================ */
 
22
 
 
23
// Qt includes
 
24
 
 
25
#include <QFile>
 
26
#include <QIODevice>
 
27
#include <QImage>
 
28
 
 
29
// KDE includes
 
30
 
 
31
#include <kdebug.h>
 
32
 
 
33
// Local includes
 
34
 
 
35
#include "pgfutils.h"
 
36
 
 
37
using namespace Digikam;
 
38
 
 
39
int main(int argc, char** argv)
 
40
{
 
41
    if (argc != 2)
 
42
    {
 
43
        kDebug() << "pgfscaled - Load scaled version of PGF image and save to PNG";
 
44
        kDebug() << "Usage: <pgffile>";
 
45
        return -1;
 
46
    }
 
47
 
 
48
    QImage img;
 
49
 
 
50
    // Write PGF file.
 
51
 
 
52
    QString fname(argv[1]);
 
53
    QFile file(fname);
 
54
 
 
55
    if ( !file.open(QIODevice::ReadOnly) )
 
56
    {
 
57
        kDebug() << "Cannot open PGF file to read...";
 
58
        return -1;
 
59
    }
 
60
 
 
61
    // PGF => QImage conversion
 
62
 
 
63
    if (!loadPGFScaled(img, file.fileName(), 1280))
 
64
    {
 
65
        kDebug() << "loadPGFScaled failed...";
 
66
        return -1;
 
67
    }
 
68
 
 
69
    img.save(file.fileName()+QString("-scaled.png"), "PNG");
 
70
 
 
71
    return 0;
 
72
}