File indexing completed on 2024-12-22 03:35:45

0001 /*
0002     File                 : ImageFilter.h
0003     Project              : LabPlot
0004     Description          : Image I/O-filter
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2015 Stefan Gerlach <stefan.gerlach@uni.kn>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #ifndef IMAGEFILTER_H
0010 #define IMAGEFILTER_H
0011 
0012 #include "backend/datasources/filters/AbstractFileFilter.h"
0013 
0014 class ImageFilterPrivate;
0015 
0016 class ImageFilter : public AbstractFileFilter {
0017     Q_OBJECT
0018     Q_ENUMS(ImportFormat)
0019 
0020 public:
0021     enum class ImportFormat { MATRIX, XYZ, XYRGB };
0022 
0023     ImageFilter();
0024     ~ImageFilter() override;
0025 
0026     static QStringList importFormats();
0027     static QString fileInfoString(const QString&);
0028 
0029     void
0030     readDataFromFile(const QString& fileName, AbstractDataSource* = nullptr, AbstractFileFilter::ImportMode = AbstractFileFilter::ImportMode::Replace) override;
0031     void write(const QString& fileName, AbstractDataSource*) override;
0032 
0033     void setImportFormat(const ImageFilter::ImportFormat);
0034     ImageFilter::ImportFormat importFormat() const;
0035 
0036     void setStartRow(const int);
0037     int startRow() const;
0038     void setEndRow(const int);
0039     int endRow() const;
0040     void setStartColumn(const int);
0041     int startColumn() const;
0042     void setEndColumn(const int);
0043     int endColumn() const;
0044 
0045     void save(QXmlStreamWriter*) const override;
0046     bool load(XmlStreamReader*) override;
0047 
0048 private:
0049     std::unique_ptr<ImageFilterPrivate> const d;
0050     friend class ImageFilterPrivate;
0051 };
0052 
0053 #endif