| 1 | // Copyright (C) 2021 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 QTEXTUREFILEDATA_P_H |
| 5 | #define QTEXTUREFILEDATA_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtGui/qtguiglobal.h> |
| 19 | #include <QSharedDataPointer> |
| 20 | #include <QLoggingCategory> |
| 21 | #include <private/qglobal_p.h> |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | class QDebug; |
| 26 | |
| 27 | Q_DECLARE_LOGGING_CATEGORY(lcQtGuiTextureIO) |
| 28 | |
| 29 | class QTextureFileDataPrivate; |
| 30 | |
| 31 | class Q_GUI_EXPORT QTextureFileData |
| 32 | { |
| 33 | public: |
| 34 | enum Mode { ByteArrayMode, ImageMode }; |
| 35 | |
| 36 | QTextureFileData(Mode mode = ByteArrayMode); |
| 37 | QTextureFileData(const QTextureFileData &other); |
| 38 | QTextureFileData &operator=(const QTextureFileData &other); |
| 39 | ~QTextureFileData(); |
| 40 | |
| 41 | bool isNull() const; |
| 42 | bool isValid() const; |
| 43 | |
| 44 | void clear(); |
| 45 | |
| 46 | QByteArray data() const; |
| 47 | void setData(const QByteArray &data); |
| 48 | void setData(const QImage &image, int level = 0, int face = 0); |
| 49 | |
| 50 | int dataOffset(int level = 0, int face = 0) const; |
| 51 | void setDataOffset(int offset, int level = 0, int face = 0); |
| 52 | |
| 53 | int dataLength(int level = 0, int face = 0) const; |
| 54 | void setDataLength(int length, int level = 0, int face = 0); |
| 55 | |
| 56 | QByteArrayView getDataView(int level = 0, int face = 0) const; |
| 57 | |
| 58 | int numLevels() const; |
| 59 | void setNumLevels(int num); |
| 60 | |
| 61 | int numFaces() const; |
| 62 | void setNumFaces(int num); |
| 63 | |
| 64 | QSize size() const; |
| 65 | void setSize(const QSize &size); |
| 66 | |
| 67 | quint32 glFormat() const; |
| 68 | void setGLFormat(quint32 format); |
| 69 | |
| 70 | quint32 glInternalFormat() const; |
| 71 | void setGLInternalFormat(quint32 format); |
| 72 | |
| 73 | quint32 glBaseInternalFormat() const; |
| 74 | void setGLBaseInternalFormat(quint32 format); |
| 75 | |
| 76 | QByteArray logName() const; |
| 77 | void setLogName(const QByteArray &name); |
| 78 | |
| 79 | QMap<QByteArray, QByteArray> keyValueMetadata() const; |
| 80 | void setKeyValueMetadata(const QMap<QByteArray, QByteArray> &keyValues); |
| 81 | |
| 82 | private: |
| 83 | QSharedDataPointer<QTextureFileDataPrivate> d; |
| 84 | friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QTextureFileData &d); |
| 85 | }; |
| 86 | |
| 87 | Q_DECLARE_TYPEINFO(QTextureFileData, Q_RELOCATABLE_TYPE); |
| 88 | |
| 89 | Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QTextureFileData &d); |
| 90 | |
| 91 | QT_END_NAMESPACE |
| 92 | |
| 93 | #endif // QABSTRACTLAYOUTSTYLEINFO_P_H |
| 94 | |