1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QIMAGEREADERWRITERHELPERS_P_H
5#define QIMAGEREADERWRITERHELPERS_P_H
6
7#include <QtGui/private/qtguiglobal_p.h>
8#include <qsharedpointer.h>
9#include "qimageiohandler.h"
10
11//
12// W A R N I N G
13// -------------
14//
15// This file is not part of the Qt API. It exists purely as an
16// implementation detail. This header file may change from version to
17// version without notice, or even be removed.
18//
19// We mean it.
20//
21
22QT_BEGIN_NAMESPACE
23
24class QFactoryLoader;
25
26namespace QImageReaderWriterHelpers {
27
28enum _qt_BuiltInFormatType {
29#ifndef QT_NO_IMAGEFORMAT_PNG
30 _qt_PngFormat,
31#endif
32#ifndef QT_NO_IMAGEFORMAT_BMP
33 _qt_BmpFormat,
34#endif
35#ifndef QT_NO_IMAGEFORMAT_PPM
36 _qt_PpmFormat,
37 _qt_PgmFormat,
38 _qt_PbmFormat,
39#endif
40#ifndef QT_NO_IMAGEFORMAT_XBM
41 _qt_XbmFormat,
42#endif
43#ifndef QT_NO_IMAGEFORMAT_XPM
44 _qt_XpmFormat,
45#endif
46 _qt_NumFormats,
47 _qt_NoFormat = -1
48};
49
50#if !defined(QT_NO_IMAGEFORMAT_PPM)
51# define MAX_MT_SIZE 20
52#elif !defined(QT_NO_IMAGEFORMAT_XBM) || !defined(QT_NO_IMAGEFORMAT_XPM)
53# define MAX_MT_SIZE 10
54#else
55# define MAX_MT_SIZE 4
56#endif
57
58struct _qt_BuiltInFormatStruct
59{
60 char extension[4];
61 char mimeType[MAX_MT_SIZE];
62};
63
64#undef MAX_MT_SIZE
65
66static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
67#ifndef QT_NO_IMAGEFORMAT_PNG
68 {.extension: "png", .mimeType: "png"},
69#endif
70#ifndef QT_NO_IMAGEFORMAT_BMP
71 {.extension: "bmp", .mimeType: "bmp"},
72#endif
73#ifndef QT_NO_IMAGEFORMAT_PPM
74 {.extension: "ppm", .mimeType: "x-portable-pixmap"},
75 {.extension: "pgm", .mimeType: "x-portable-graymap"},
76 {.extension: "pbm", .mimeType: "x-portable-bitmap"},
77#endif
78#ifndef QT_NO_IMAGEFORMAT_XBM
79 {.extension: "xbm", .mimeType: "x-xbitmap"},
80#endif
81#ifndef QT_NO_IMAGEFORMAT_XPM
82 {.extension: "xpm", .mimeType: "x-xpixmap"},
83#endif
84};
85static_assert(_qt_NumFormats == sizeof _qt_BuiltInFormats / sizeof *_qt_BuiltInFormats);
86
87#ifndef QT_NO_IMAGEFORMATPLUGIN
88QSharedPointer<QFactoryLoader> pluginLoader();
89#endif
90
91enum Capability {
92 CanRead,
93 CanWrite
94};
95QList<QByteArray> supportedImageFormats(Capability cap);
96QList<QByteArray> supportedMimeTypes(Capability cap);
97QList<QByteArray> imageFormatsForMimeType(const QByteArray &mimeType, Capability cap);
98
99}
100
101QT_END_NAMESPACE
102
103#endif // QIMAGEREADERWRITERHELPERS_P_H
104

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