1/****************************************************************************
2**
3** Copyright (C) 2018 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QIMAGEREADERWRITERHELPERS_P_H
41#define QIMAGEREADERWRITERHELPERS_P_H
42
43#include <QtGui/private/qtguiglobal_p.h>
44#include <qsharedpointer.h>
45#include "qimageiohandler.h"
46
47//
48// W A R N I N G
49// -------------
50//
51// This file is not part of the Qt API. It exists purely as an
52// implementation detail. This header file may change from version to
53// version without notice, or even be removed.
54//
55// We mean it.
56//
57
58QT_BEGIN_NAMESPACE
59
60class QFactoryLoader;
61
62namespace QImageReaderWriterHelpers {
63
64enum _qt_BuiltInFormatType {
65#ifndef QT_NO_IMAGEFORMAT_PNG
66 _qt_PngFormat,
67#endif
68#ifndef QT_NO_IMAGEFORMAT_BMP
69 _qt_BmpFormat,
70#endif
71#ifndef QT_NO_IMAGEFORMAT_PPM
72 _qt_PpmFormat,
73 _qt_PgmFormat,
74 _qt_PbmFormat,
75#endif
76#ifndef QT_NO_IMAGEFORMAT_XBM
77 _qt_XbmFormat,
78#endif
79#ifndef QT_NO_IMAGEFORMAT_XPM
80 _qt_XpmFormat,
81#endif
82 _qt_NumFormats,
83 _qt_NoFormat = -1
84};
85
86#if !defined(QT_NO_IMAGEFORMAT_PPM)
87# define MAX_MT_SIZE 20
88#elif !defined(QT_NO_IMAGEFORMAT_XBM) || !defined(QT_NO_IMAGEFORMAT_XPM)
89# define MAX_MT_SIZE 10
90#else
91# define MAX_MT_SIZE 4
92#endif
93
94struct _qt_BuiltInFormatStruct
95{
96 char extension[4];
97 char mimeType[MAX_MT_SIZE];
98};
99
100#undef MAX_MT_SIZE
101
102static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
103#ifndef QT_NO_IMAGEFORMAT_PNG
104 {.extension: "png", .mimeType: "png"},
105#endif
106#ifndef QT_NO_IMAGEFORMAT_BMP
107 {.extension: "bmp", .mimeType: "bmp"},
108#endif
109#ifndef QT_NO_IMAGEFORMAT_PPM
110 {.extension: "ppm", .mimeType: "x-portable-pixmap"},
111 {.extension: "pgm", .mimeType: "x-portable-graymap"},
112 {.extension: "pbm", .mimeType: "x-portable-bitmap"},
113#endif
114#ifndef QT_NO_IMAGEFORMAT_XBM
115 {.extension: "xbm", .mimeType: "x-xbitmap"},
116#endif
117#ifndef QT_NO_IMAGEFORMAT_XPM
118 {.extension: "xpm", .mimeType: "x-xpixmap"},
119#endif
120};
121Q_STATIC_ASSERT(_qt_NumFormats == sizeof _qt_BuiltInFormats / sizeof *_qt_BuiltInFormats);
122
123#ifndef QT_NO_IMAGEFORMATPLUGIN
124QSharedPointer<QFactoryLoader> pluginLoader();
125#endif
126
127enum Capability {
128 CanRead,
129 CanWrite
130};
131QList<QByteArray> supportedImageFormats(Capability cap);
132QList<QByteArray> supportedMimeTypes(Capability cap);
133QList<QByteArray> imageFormatsForMimeType(const QByteArray &mimeType, Capability cap);
134
135}
136
137QT_END_NAMESPACE
138
139#endif // QIMAGEREADERWRITERHELPERS_P_H
140

source code of qtbase/src/gui/image/qimagereaderwriterhelpers_p.h