Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qicnshandler.cpp File Reference

(8a62fb36a8c456fb4e1229cca8bfca88f6e57890)

#include "qicnshandler_p.h"
#include <QtCore/qmath.h>
#include <QtCore/qendian.h>
#include <QtCore/qregularexpression.h>
#include <QtCore/qbuffer.h>
#include <QtGui/qimage.h>
+ Include dependency graph for qicnshandler.cpp:

Go to the source code of this file.

Functions

 Q_STATIC_ASSERT (sizeof(ICNSColorTableMono)/sizeof(ICNSColorTableMono[0])==(1<< ICNSEntry::DepthMono))
 
 Q_STATIC_ASSERT (sizeof(ICNSColorTable4bit)/sizeof(ICNSColorTable4bit[0])==(1<< ICNSEntry::Depth4bit))
 
 Q_STATIC_ASSERT (sizeof(ICNSColorTable8bit)/sizeof(ICNSColorTable8bit[0])==(1<< ICNSEntry::Depth8bit))
 
static QDataStreamoperator>> (QDataStream &in, ICNSBlockHeader &p)
 
static QDataStreamoperator<< (QDataStream &out, const ICNSBlockHeader &p)
 
static bool isPowOf2OrDividesBy16 (quint32 u, qreal r)
 
static bool isBlockHeaderValid (const ICNSBlockHeader &header, quint64 bound=0)
 
static bool isIconCompressed (const ICNSEntry &icon)
 
static bool isMaskSuitable (const ICNSEntry &mask, const ICNSEntry &icon, ICNSEntry::Depth target)
 
static QByteArray nameFromOSType (quint32 ostype)
 
static quint32 nameToOSType (const QByteArray &ostype)
 
static QByteArray nameForCompressedIcon (quint8 iconNumber)
 
static QList< QRgbgetColorTable (ICNSEntry::Depth depth)
 
static bool parseIconEntryData (ICNSEntry &icon, QIODevice *device)
 
static bool parseIconEntryInfo (ICNSEntry &icon)
 
static QImage readMask (const ICNSEntry &mask, QDataStream &stream)
 
template<ICNSEntry::Depth depth>
static QImage readLowDepthIcon (const ICNSEntry &icon, QDataStream &stream)
 
static QImage read32bitIcon (const ICNSEntry &icon, QDataStream &stream)
 

Variables

static QT_BEGIN_NAMESPACE const quint8 ICNSBlockHeaderSize = 8
 
static const QRgb ICNSColorTableMono []
 
static const QRgb ICNSColorTable4bit []
 
static const QRgb ICNSColorTable8bit []
 

Function Documentation

◆ getColorTable()

static QList< QRgb > getColorTable ( ICNSEntry::Depth depth)
inlinestatic

Definition at line 363 of file qicnshandler.cpp.

References ICNSEntry::Depth4bit, ICNSEntry::Depth8bit, ICNSEntry::DepthMono, ICNSColorTable4bit, ICNSColorTable8bit, ICNSColorTableMono, and QRgb.

Referenced by readLowDepthIcon().

+ Here is the caller graph for this function:

◆ isBlockHeaderValid()

static bool isBlockHeaderValid ( const ICNSBlockHeader & header,
quint64 bound = 0 )
inlinestatic

Definition at line 324 of file qicnshandler.cpp.

References header(), ICNSBlockHeaderSize, and qBound().

Referenced by QICNSHandler::write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isIconCompressed()

static bool isIconCompressed ( const ICNSEntry & icon)
inlinestatic

Definition at line 330 of file qicnshandler.cpp.

References icon, ICNSEntry::JP2, and ICNSEntry::PNG.

Referenced by parseIconEntryInfo().

+ Here is the caller graph for this function:

◆ isMaskSuitable()

static bool isMaskSuitable ( const ICNSEntry & mask,
const ICNSEntry & icon,
ICNSEntry::Depth target )
inlinestatic

Definition at line 335 of file qicnshandler.cpp.

References icon.

◆ isPowOf2OrDividesBy16()

static bool isPowOf2OrDividesBy16 ( quint32 u,
qreal r )
inlinestatic

Definition at line 319 of file qicnshandler.cpp.

Referenced by parseIconEntryInfo().

+ Here is the caller graph for this function:

◆ nameForCompressedIcon()

static QByteArray nameForCompressedIcon ( quint8 iconNumber)
inlinestatic

Definition at line 354 of file qicnshandler.cpp.

References base, QByteArray::number(), and QByteArrayLiteral.

Referenced by QICNSHandler::write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nameFromOSType()

static QByteArray nameFromOSType ( quint32 ostype)
inlinestatic

Definition at line 341 of file qicnshandler.cpp.

References QByteArray(), and qToBigEndian().

Referenced by QICNSHandler::option(), parseIconEntryInfo(), QICNSHandler::read(), and readMask().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nameToOSType()

static quint32 nameToOSType ( const QByteArray & ostype)
inlinestatic

Definition at line 347 of file qicnshandler.cpp.

References QByteArray::constData(), qFromBigEndian(), and QByteArray::size().

Referenced by QICNSHandler::write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<()

static QDataStream & operator<< ( QDataStream & out,
const ICNSBlockHeader & p )
inlinestatic

Definition at line 312 of file qicnshandler.cpp.

References out.

◆ operator>>()

static QDataStream & operator>> ( QDataStream & in,
ICNSBlockHeader & p )
inlinestatic

Definition at line 305 of file qicnshandler.cpp.

◆ parseIconEntryData()

static bool parseIconEntryData ( ICNSEntry & icon,
QIODevice * device )
static

◆ parseIconEntryInfo()

static bool parseIconEntryInfo ( ICNSEntry & icon)
static

◆ Q_STATIC_ASSERT() [1/3]

Q_STATIC_ASSERT ( sizeof(ICNSColorTable4bit)/sizeof(ICNSColorTable4bit[0]) = =(1<< ICNSEntry::Depth4bit))

◆ Q_STATIC_ASSERT() [2/3]

Q_STATIC_ASSERT ( sizeof(ICNSColorTable8bit)/sizeof(ICNSColorTable8bit[0]) = =(1<< ICNSEntry::Depth8bit))

◆ Q_STATIC_ASSERT() [3/3]

Q_STATIC_ASSERT ( sizeof(ICNSColorTableMono)/sizeof(ICNSColorTableMono[0]) = =(1<< ICNSEntry::DepthMono))

◆ read32bitIcon()

static QImage read32bitIcon ( const ICNSEntry & icon,
QDataStream & stream )
static

Definition at line 571 of file qicnshandler.cpp.

References QImageIOHandler::allocateImage(), QByteArray::constData(), QImage::Format_RGB32, i, icon, QByteArray::isEmpty(), line, qBlue(), qGreen(), qRed(), QRgb, qRgb(), rgb, and ICNSEntry::RLE24.

Referenced by QICNSHandler::read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readLowDepthIcon()

template<ICNSEntry::Depth depth>
static QImage readLowDepthIcon ( const ICNSEntry & icon,
QDataStream & stream )
static

Definition at line 530 of file qicnshandler.cpp.

References QImageIOHandler::allocateImage(), ICNSEntry::Depth4bit, ICNSEntry::Depth8bit, ICNSEntry::DepthMono, QImage::Format_Indexed8, QImage::Format_Mono, getColorTable(), icon, and Q_STATIC_ASSERT.

+ Here is the call graph for this function:

◆ readMask()

static QImage readMask ( const ICNSEntry & mask,
QDataStream & stream )
static

Definition at line 492 of file qicnshandler.cpp.

References QImageIOHandler::allocateImage(), ICNSEntry::Depth8bit, ICNSEntry::DepthMono, QImage::Format_RGB32, ICNSEntry::IconPlusMask, imageDataSize(), ICNSEntry::IsMask, line, nameFromOSType(), pos, QRgb, qRgb(), and qWarning.

Referenced by QICNSHandler::read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ ICNSBlockHeaderSize

QT_BEGIN_NAMESPACE const quint8 ICNSBlockHeaderSize = 8
static

Definition at line 17 of file qicnshandler.cpp.

Referenced by isBlockHeaderValid(), and QICNSHandler::write().

◆ ICNSColorTable4bit

const QRgb ICNSColorTable4bit[]
static
Initial value:
= {
qRgb(0xFF, 0xFF, 0xFF),
qRgb(0xFC, 0xF3, 0x05),
qRgb(0xFF, 0x64, 0x02),
qRgb(0xDD, 0x08, 0x06),
qRgb(0xF2, 0x08, 0x84),
qRgb(0x46, 0x00, 0xA5),
qRgb(0x00, 0x00, 0xD4),
qRgb(0x02, 0xAB, 0xEA),
qRgb(0x1F, 0xB7, 0x14),
qRgb(0x00, 0x64, 0x11),
qRgb(0x56, 0x2C, 0x05),
qRgb(0x90, 0x71, 0x3A),
qRgb(0xC0, 0xC0, 0xC0),
qRgb(0x80, 0x80, 0x80),
qRgb(0x40, 0x40, 0x40),
qRgb(0x00, 0x00, 0x00)
}
constexpr QRgb qRgb(int r, int g, int b)
Definition qrgb.h:30

Definition at line 25 of file qicnshandler.cpp.

Referenced by getColorTable().

◆ ICNSColorTable8bit

const QRgb ICNSColorTable8bit[]
static

Definition at line 45 of file qicnshandler.cpp.

Referenced by getColorTable().

◆ ICNSColorTableMono

const QRgb ICNSColorTableMono[]
static
Initial value:
= {
qRgb(0xFF, 0xFF, 0xFF),
qRgb(0x00, 0x00, 0x00)
}

Definition at line 19 of file qicnshandler.cpp.

Referenced by getColorTable().