File indexing completed on 2024-04-28 15:32:18

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2004 Antonio Larrosa <larrosa@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "kpixmapregionselectordialog.h"
0009 #include <QApplication>
0010 #include <QFile>
0011 #include <QImage>
0012 #include <QPixmap>
0013 #include <iostream>
0014 
0015 int main(int argc, char **argv)
0016 {
0017     QApplication app(argc, argv);
0018     app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
0019 
0020     if (argc <= 1) {
0021         std::cerr << "Usage: kpixmapregionselectordialogtest <imageFile>" << std::endl;
0022         return 1;
0023     }
0024 
0025     QPixmap pix(QFile::decodeName(argv[1]));
0026     QImage image = KPixmapRegionSelectorDialog::getSelectedImage(pix, 100, 100);
0027     image.save(QStringLiteral("output.png"), "PNG");
0028 
0029     return 0;
0030 }