| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Copyright (C) 2016 Alex Char. |
| 5 | ** Contact: https://www.qt.io/licensing/ |
| 6 | ** |
| 7 | ** This file is part of the plugins of the Qt Toolkit. |
| 8 | ** |
| 9 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 10 | ** Commercial License Usage |
| 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 12 | ** accordance with the commercial license agreement provided with the |
| 13 | ** Software or, alternatively, in accordance with the terms contained in |
| 14 | ** a written agreement between you and The Qt Company. For licensing terms |
| 15 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 16 | ** information use the contact form at https://www.qt.io/contact-us. |
| 17 | ** |
| 18 | ** GNU Lesser General Public License Usage |
| 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 20 | ** General Public License version 3 as published by the Free Software |
| 21 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 22 | ** packaging of this file. Please review the following information to |
| 23 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 24 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 25 | ** |
| 26 | ** GNU General Public License Usage |
| 27 | ** Alternatively, this file may be used under the terms of the GNU |
| 28 | ** General Public License version 2.0 or (at your option) the GNU General |
| 29 | ** Public license version 3 or any later version approved by the KDE Free |
| 30 | ** Qt Foundation. The licenses are as published by the Free Software |
| 31 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 32 | ** included in the packaging of this file. Please review the following |
| 33 | ** information to ensure the GNU General Public License requirements will |
| 34 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 35 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 36 | ** |
| 37 | ** $QT_END_LICENSE$ |
| 38 | ** |
| 39 | ****************************************************************************/ |
| 40 | |
| 41 | #ifndef QICNSHANDLER_P_H |
| 42 | #define QICNSHANDLER_P_Hcxx . . $ `src/plugins/imageformats/icns/qicnshandler_p.h:42:9`! |
| 43 | |
| 44 | #include <QtGui/qimageiohandler.h> |
| 45 | #include <QtCore/qvector.h> |
| 46 | |
| 47 | #ifndef QT_NO_DATASTREAM |
| 48 | |
| 49 | #define MAKEOSTYPEcxx . . $ `src/plugins/imageformats/icns/qicnshandler_p.h:49:9`!(c0,c1,c2,c3) (((quint8)c0 << 24) | ((quint8)c1 << 16) | ((quint8)c2 << 8) | (quint8)c3) |
| 50 | |
| 51 | QT_BEGIN_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:148:10`! |
| 52 | |
| 53 | struct ICNSBlockHeadercxx . . $ ICNSBlockHeader# |
| 54 | { |
| 55 | enum OScxx . . $ ICNSBlockHeader#OS# { |
| 56 | TypeIcnscxx . . $ ICNSBlockHeader#TypeIcns. = MAKEOSTYPEcxx . . $ quint8#('i', 'c', 'n', 's'), // Icns container magic |
| 57 | TypeToccxx . . $ ICNSBlockHeader#TypeToc. = MAKEOSTYPEcxx . . $ quint8#('T', 'O', 'C', ' '), // Table of contents |
| 58 | TypeIcnvcxx . . $ ICNSBlockHeader#TypeIcnv. = MAKEOSTYPEcxx . . $ quint8#('i', 'c', 'n', 'V'), // Icon Composer version |
| 59 | // Legacy: |
| 60 | TypeClutcxx . . $ ICNSBlockHeader#TypeClut. = MAKEOSTYPEcxx . . $ quint8#('c', 'l', 'u', 't'), // Color look-up table (pre-OS X resources) |
| 61 | TypeTilecxx . . $ ICNSBlockHeader#TypeTile. = MAKEOSTYPEcxx . . $ quint8#('t', 'i', 'l', 'e'), // Container (icon variants) |
| 62 | TypeOvercxx . . $ ICNSBlockHeader#TypeOver. = MAKEOSTYPEcxx . . $ `src/plugins/imageformats/icns/qicnshandler_p.h:49:9`!('o', 'v', 'e', 'r'), // Container (icon variants) |
| 63 | TypeOpencxx . . $ ICNSBlockHeader#TypeOpen. = MAKEOSTYPEcxx . . $ `src/plugins/imageformats/icns/qicnshandler_p.h:49:9`!('o', 'p', 'e', 'n'), // Container (icon variants) |
| 64 | TypeDropcxx . . $ ICNSBlockHeader#TypeDrop. = MAKEOSTYPEcxx . . $ `src/plugins/imageformats/icns/qicnshandler_p.h:49:9`!('d', 'r', 'o', 'p'), // Container (icon variants) |
| 65 | TypeOdrpcxx . . $ ICNSBlockHeader#TypeOdrp. = MAKEOSTYPEcxx . . $ `src/plugins/imageformats/icns/qicnshandler_p.h:49:9`!('o', 'd', 'r', 'p'), // Container (icon variants) |
| 66 | }; |
| 67 | |
| 68 | quint32cxx . . $ quint32# ostypecxx . . $ ICNSBlockHeader#ostype.; |
| 69 | quint32cxx . . $ quint32# lengthcxx . . $ ICNSBlockHeader#length.; |
| 70 | }; |
| 71 | |
| 72 | struct ICNSEntrycxx . . $ ICNSEntry# |
| 73 | { |
| 74 | enum Groupcxx . . $ ICNSEntry#Group# { |
| 75 | GroupUnknowncxx . . $ ICNSEntry#GroupUnknown. = 0, // Default for invalid ones |
| 76 | GroupMinicxx . . $ ICNSEntry#GroupMini. = 'm', // "mini" (16x12) |
| 77 | GroupSmallcxx . . $ ICNSEntry#GroupSmall. = 's', // "small" (16x16) |
| 78 | GroupLargecxx . . $ ICNSEntry#GroupLarge. = 'l', // "large" (32x32) |
| 79 | GroupHugecxx . . $ ICNSEntry#GroupHuge. = 'h', // "huge" (48x48) |
| 80 | GroupThumbnailcxx . . $ ICNSEntry#GroupThumbnail. = 't', // "thumbnail" (128x128) |
| 81 | GroupPortablecxx . . $ ICNSEntry#GroupPortable. = 'p', // "portable"? (Speculation, used for png/jp2) |
| 82 | GroupCompressedcxx . . $ ICNSEntry#GroupCompressed. = 'c', // "compressed"? (Speculation, used for png/jp2) |
| 83 | // Legacy icons: |
| 84 | GroupICONcxx . . $ ICNSEntry#GroupICON. = 'N', // "ICON" (32x32) |
| 85 | }; |
| 86 | enum Depthcxx . . $ ICNSEntry#Depth# { |
| 87 | DepthUnknowncxx . . $ ICNSEntry#DepthUnknown. = 0, // Default for invalid or compressed ones |
| 88 | DepthMonocxx . . $ ICNSEntry#DepthMono. = 1, |
| 89 | Depth4bitcxx . . $ ICNSEntry#Depth4bit. = 4, |
| 90 | Depth8bitcxx . . $ ICNSEntry#Depth8bit. = 8, |
| 91 | Depth32bitcxx . . $ ICNSEntry#Depth32bit. = 32 |
| 92 | }; |
| 93 | enum Flagscxx . . $ ICNSEntry#Flags# { |
| 94 | Unknowncxx . . $ ICNSEntry#Unknown. = 0x0, // Default for invalid ones |
| 95 | IsIconcxx . . $ ICNSEntry#IsIcon. = 0x1, // Contains a raw icon without alpha or compressed icon |
| 96 | IsMaskcxx . . $ ICNSEntry#IsMask. = 0x2, // Contains alpha mask |
| 97 | IconPlusMaskcxx . . $ ICNSEntry#IconPlusMask. = IsIconcxx . . $ ICNSEntry#IsIcon. | IsMaskcxx . . $ ICNSEntry#IsMask. // Contains raw icon and mask combined in one entry (double size) |
| 98 | }; |
| 99 | enum Formatcxx . . $ ICNSEntry#Format# { |
| 100 | FormatUnknowncxx . . $ ICNSEntry#FormatUnknown. = 0, // Default for invalid or undetermined ones |
| 101 | RawIconcxx . . $ ICNSEntry#RawIcon., // Raw legacy icon, uncompressed |
| 102 | RLE24cxx . . $ ICNSEntry#RLE24., // Raw 32bit icon, data is compressed |
| 103 | PNGcxx . . $ ICNSEntry#PNG., // Compressed icon in PNG format |
| 104 | JP2cxx . . $ ICNSEntry#JP2. // Compressed icon in JPEG2000 format |
| 105 | }; |
| 106 | |
| 107 | quint32cxx . . $ quint32# ostypecxx . . $ ICNSEntry#ostype.; // Real OSType |
| 108 | quint32cxx . . $ quint32# variantcxx . . $ ICNSEntry#variant.; // Virtual OSType: a parent container, zero if parent is icns root |
| 109 | Groupcxx . . $ ICNSEntry#Group# groupcxx . . $ ICNSEntry#group.; // ASCII character number |
| 110 | quint32cxx . . $ quint32# widthcxx . . $ ICNSEntry#width.; // For uncompressed icons only, zero for compressed ones for now |
| 111 | quint32cxx . . $ quint32# heightcxx . . $ ICNSEntry#height.; // For uncompressed icons only, zero for compressed ones fow now |
| 112 | Depthcxx . . $ ICNSEntry#Depth# depthcxx . . $ ICNSEntry#depth.; // Color depth |
| 113 | Flagscxx . . $ ICNSEntry#Flags# flagscxx . . $ ICNSEntry#flags.; // Flags to determine the type of entry |
| 114 | Formatcxx . . $ ICNSEntry#Format# dataFormatcxx . . $ ICNSEntry#dataFormat.; // Format of the image data |
| 115 | quint32cxx . . $ quint32# dataLengthcxx . . $ ICNSEntry#dataLength.; // Length of the image data in bytes |
| 116 | qint64cxx . . $ qint64# dataOffsetcxx . . $ ICNSEntry#dataOffset.; // Offset from the initial position of the file/device |
| 117 | |
| 118 | ICNSEntrycxx . . $ ICNSEntry#ICNSEntry(49f6e7a06ebc5aa8).() : |
| 119 | ostypecxx . . $ ICNSEntry#ostype.(0), variantcxx . . $ ICNSEntry#variant.(0), groupcxx . . $ ICNSEntry#group.(GroupUnknowncxx . . $ ICNSEntry#GroupUnknown.), widthcxx . . $ ICNSEntry#width.(0), heightcxx . . $ ICNSEntry#height.(0), depthcxx . . $ ICNSEntry#depth.(DepthUnknowncxx . . $ ICNSEntry#DepthUnknown.), |
| 120 | flagscxx . . $ ICNSEntry#flags.(Unknowncxx . . $ ICNSEntry#Unknown.), dataFormatcxx . . $ ICNSEntry#dataFormat.(FormatUnknowncxx . . $ ICNSEntry#FormatUnknown.), dataLengthcxx . . $ ICNSEntry#dataLength.(0), dataOffsetcxx . . $ ICNSEntry#dataOffset.(0) |
| 121 | { |
| 122 | } |
| 123 | }; |
| 124 | Q_DECLARE_TYPEINFOcxx . . $ QTypeInfo#(ICNSEntry, Q_MOVABLE_TYPE); |
| 125 | |
| 126 | class QICNSHandlercxx . . $ QICNSHandler# : public QImageIOHandlercxx . . $ QImageIOHandler# |
| 127 | { |
| 128 | public: |
| 129 | QICNSHandlercxx . . $ QICNSHandler#QICNSHandler(49f6e7a06ebc5aa8).(); |
| 130 | |
| 131 | bool canReadcxx . . $ QICNSHandler#canRead(50ce9a9e25b4a850).() const override; |
| 132 | bool readcxx . . $ QICNSHandler#read(5a6f164356166ee6).(QImagecxx . . $ QImage# *image) override; |
| 133 | bool writecxx . . $ QICNSHandler#write(73afe20316494619).(const QImagecxx . . $ QImage# &image) override; |
| 134 | |
| 135 | bool supportsOptioncxx . . $ QICNSHandler#supportsOption(55c593ff6d26ae20).(ImageOptioncxx . . $ QImageIOHandler#ImageOption# option) const override; |
| 136 | QVariantcxx . . $ QVariant# optioncxx . . $ QICNSHandler#option(5e4f138555277744).(ImageOptioncxx . . $ QImageIOHandler#ImageOption# option) const override; |
| 137 | |
| 138 | int imageCountcxx . . $ QICNSHandler#imageCount(455f465bc33b4cdf).() const override; |
| 139 | bool jumpToImagecxx . . $ QICNSHandler#jumpToImage(83c267b20bac841a).(int imageNumber) override; |
| 140 | bool jumpToNextImagecxx . . $ QICNSHandler#jumpToNextImage(c9857a73d68e59ba).() override; |
| 141 | |
| 142 | static bool canReadcxx . . $ QICNSHandler#canRead(33ee36428ee918e7).(QIODevicecxx . . $ QIODevice# *device); |
| 143 | |
| 144 | private: |
| 145 | bool ensureScannedcxx . . $ QICNSHandler#ensureScanned(50ce9a9e25b4a850).() const; |
| 146 | bool scanDevicecxx . . $ QICNSHandler#scanDevice(c9857a73d68e59ba).(); |
| 147 | bool addEntrycxx . . $ QICNSHandler#addEntry(6f518925a7d9ee32).(const ICNSBlockHeadercxx . . $ ICNSBlockHeader# &header, qint64cxx . . $ qint64# imgDataOffset, quint32cxx . . $ quint32# variant = 0); |
| 148 | const ICNSEntrycxx . . $ ICNSEntry# &getIconMaskcxx . . $ QICNSHandler#getIconMask(bce7927af6acad97).(const ICNSEntrycxx . . $ ICNSEntry# &icon) const; |
| 149 | |
| 150 | private: |
| 151 | enum ScanStatecxx . . $ QICNSHandler#ScanState# { |
| 152 | ScanErrorcxx . . $ QICNSHandler#ScanError. = -1, |
| 153 | ScanNotScannedcxx . . $ QICNSHandler#ScanNotScanned. = 0, |
| 154 | ScanSuccesscxx . . $ QICNSHandler#ScanSuccess. = 1, |
| 155 | }; |
| 156 | |
| 157 | int m_currentIconIndexcxx . . $ QICNSHandler#m_currentIconIndex.; |
| 158 | QVectorcxx . . $ QVector#<ICNSEntrycxx . . $ ICNSEntry#> m_iconscxx . . $ QICNSHandler#m_icons.; |
| 159 | QVectorcxx . . $ QVector#<ICNSEntrycxx . . $ ICNSEntry#> m_maskscxx . . $ QICNSHandler#m_masks.; |
| 160 | ScanStatecxx . . $ QICNSHandler#ScanState# m_statecxx . . $ QICNSHandler#m_state.; |
| 161 | }; |
| 162 | |
| 163 | QT_END_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:149:10`! |
| 164 | |
| 165 | #endif // QT_NO_DATASTREAM |
| 166 | |
| 167 | #endif /* QICNSHANDLER_P_H */ |