File indexing completed on 2024-05-12 16:06:41

0001 /*
0002     SPDX-FileCopyrightText: 2008 Tobias Koenig <tokoe@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef FAXDOCUMENT_H
0007 #define FAXDOCUMENT_H
0008 
0009 #include <QImage>
0010 
0011 /**
0012  * Loads a G3/G4 fax document and provides methods
0013  * to convert it into a QImage.
0014  */
0015 class FaxDocument
0016 {
0017 public:
0018     /**
0019      * Describes the type of the fax document.
0020      */
0021     enum DocumentType {
0022         G3, ///< G3 encoded fax document
0023         G4  ///< G4 encoded fax document
0024     };
0025 
0026     /**
0027      * Creates a new fax document from the given @p fileName.
0028      *
0029      * @param fileName The name of the fax file.
0030      * @param type The type of the fax document.
0031      */
0032     explicit FaxDocument(const QString &fileName, DocumentType type = G3);
0033 
0034     /**
0035      * Destroys the fax document.
0036      */
0037     ~FaxDocument();
0038 
0039     FaxDocument(const FaxDocument &) = delete;
0040     FaxDocument &operator=(const FaxDocument &) = delete;
0041 
0042     /**
0043      * Loads the document.
0044      *
0045      * @return @c true if the document can be loaded successfully, @c false otherwise.
0046      */
0047     bool load();
0048 
0049     /**
0050      * Returns the document as an image.
0051      */
0052     QImage image() const;
0053 
0054 private:
0055     class Private;
0056     Private *const d;
0057 };
0058 
0059 #endif