File indexing completed on 2024-04-28 04:18:52
0001 // vim: set tabstop=4 shiftwidth=4 expandtab 0002 /* 0003 Gwenview: an image viewer 0004 Copyright 2007 Aurélien Gâteau <agateau@kde.org> 0005 0006 This program is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU General Public License 0008 as published by the Free Software Foundation; either version 2 0009 of the License, or (at your option) any later version. 0010 0011 This program is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 GNU General Public License for more details. 0015 0016 You should have received a copy of the GNU General Public License 0017 along with this program; if not, write to the Free Software 0018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0019 0020 */ 0021 #ifndef JPEGCONTENT_H 0022 #define JPEGCONTENT_H 0023 0024 // Local 0025 #include <QByteArray> 0026 #include <lib/gwenviewlib_export.h> 0027 #include <lib/orientation.h> 0028 class QImage; 0029 class QSize; 0030 class QString; 0031 class QIODevice; 0032 0033 namespace Exiv2 0034 { 0035 class Image; 0036 } 0037 0038 namespace Gwenview 0039 { 0040 class GWENVIEWLIB_EXPORT JpegContent 0041 { 0042 public: 0043 JpegContent(); 0044 ~JpegContent(); 0045 0046 Orientation orientation() const; 0047 void resetOrientation(); 0048 0049 int dotsPerMeterX() const; 0050 int dotsPerMeterY() const; 0051 0052 QSize size() const; 0053 0054 QString comment() const; 0055 void setComment(const QString &); 0056 0057 void transform(Orientation); 0058 0059 QImage thumbnail() const; 0060 void setThumbnail(const QImage &); 0061 0062 // Recreate raw data to represent image 0063 // Note: thumbnail must be updated separately 0064 void setImage(const QImage &image); 0065 0066 bool load(const QString &file); 0067 bool loadFromData(const QByteArray &rawData); 0068 /** 0069 * Use this version of loadFromData if you already have an Exiv2::Image* 0070 */ 0071 bool loadFromData(const QByteArray &rawData, Exiv2::Image *); 0072 bool save(const QString &file); 0073 bool save(QIODevice *); 0074 0075 QByteArray rawData() const; 0076 0077 QString errorString() const; 0078 0079 private: 0080 struct Private; 0081 Private *d; 0082 0083 JpegContent(const JpegContent &) = delete; 0084 void operator=(const JpegContent &) = delete; 0085 void applyPendingTransformation(); 0086 int dotsPerMeter(const QString &keyName) const; 0087 }; 0088 0089 } // namespace 0090 0091 #endif /* JPEGCONTENT_H */