Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qxpmhandler.cpp File Reference
#include "private/qxpmhandler_p.h"
#include <qbytearraymatcher.h>
#include <qdebug.h>
#include <qimage.h>
#include <qloggingcategory.h>
#include <qmap.h>
#include <qtextstream.h>
#include <qvariant.h>
#include <private/qcolor_p.h>
#include <private/qduplicatetracker_p.h>
#include <private/qtools_p.h>
#include <algorithm>
#include <array>
+ Include dependency graph for qxpmhandler.cpp:

Go to the source code of this file.

Classes

struct  XPMRGBData
 

Macros

#define QRGB(r, g, b)   (r*65536 + g*256 + b)
 

Functions

static quint64 xpmHash (const QString &str)
 
static quint64 xpmHash (char *str)
 
bool operator< (const char *name, const XPMRGBData &data)
 
bool operator< (const XPMRGBData &data, const char *name)
 
static std::optional< QRgbqt_get_named_xpm_rgb (const char *name_no_space)
 
static QString fbname (const QString &fileName)
 
static bool read_xpm_string (QByteArray &buf, QIODevice *d, const char *const *source, int &index, QByteArray &state)
 
static bool is_xpm_color_spec_prefix (const QByteArray &prefix)
 
static bool read_xpm_header (QIODevice *device, const char *const *source, int &index, QByteArray &state, int *cpp, int *ncols, int *w, int *h)
 
static bool read_xpm_body (QIODevice *device, const char *const *source, int &index, QByteArray &state, int cpp, int ncols, int w, int h, QImage &image)
 
bool qt_read_xpm_image_or_array (QIODevice *device, const char *const *source, QImage &image)
 
static const char * xpm_color_name (int cpp, int index, CharBuffer< 5 > &&returnable={})
 
static bool write_xpm_image (const QImage &sourceImage, QIODevice *device, const QString &fileName)
 

Variables

static const int xpmRgbTblSize = 657
 
static const struct XPMRGBData xpmRgbTbl []
 

Macro Definition Documentation

◆ QRGB

#define QRGB (   r,
  g,
  b 
)    (r*65536 + g*256 + b)

Definition at line 52 of file qxpmhandler.cpp.

Function Documentation

◆ fbname()

static QString fbname ( const QString fileName)
static

Definition at line 735 of file qxpmhandler.cpp.

References ch, fileName, QString::fromLatin1(), i, QtMiscUtils::isAsciiLetterOrNumber(), and qMax().

Referenced by write_xpm_image().

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

◆ is_xpm_color_spec_prefix()

static bool is_xpm_color_spec_prefix ( const QByteArray prefix)
static

Definition at line 803 of file qxpmhandler.cpp.

Referenced by read_xpm_body().

+ Here is the caller graph for this function:

◆ operator<() [1/2]

bool operator< ( const char *  name,
const XPMRGBData data 
)
inline

Definition at line 719 of file qxpmhandler.cpp.

References qstrcmp().

+ Here is the call graph for this function:

◆ operator<() [2/2]

bool operator< ( const XPMRGBData data,
const char *  name 
)
inline

Definition at line 721 of file qxpmhandler.cpp.

References qstrcmp().

+ Here is the call graph for this function:

◆ qt_get_named_xpm_rgb()

static std::optional< QRgb > qt_get_named_xpm_rgb ( const char *  name_no_space)
inlinestatic

Definition at line 724 of file qxpmhandler.cpp.

References xpmRgbTbl, and xpmRgbTblSize.

Referenced by read_xpm_body().

+ Here is the caller graph for this function:

◆ qt_read_xpm_image_or_array()

bool qt_read_xpm_image_or_array ( QIODevice device,
const char *const *  source,
QImage image 
)

Definition at line 997 of file qxpmhandler.cpp.

References cpp, device, matcher, qMakeStaticByteArrayMatcher(), read_xpm_body(), read_xpm_header(), and state.

Referenced by QImage::QImage().

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

◆ read_xpm_body()

static bool read_xpm_body ( QIODevice device,
const char *const *  source,
int &  index,
QByteArray state,
int  cpp,
int  ncols,
int  w,
int  h,
QImage image 
)
static

Definition at line 838 of file qxpmhandler.cpp.

References QImageIOHandler::allocateImage(), QList< T >::at(), cpp, d, device, QImage::Format_ARGB32, QImage::Format_Indexed8, QImage::Format_RGB32, i, QListSpecialMethodsBase< T >::indexOf(), QMap< Key, T >::insert(), is_xpm_color_spec_prefix(), qCWarning, QRgb, qt_get_hex_rgb(), qt_get_named_xpm_rgb(), read_xpm_string(), QList< T >::size(), state, and xpmHash().

Referenced by qt_read_xpm_image_or_array().

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

◆ read_xpm_header()

static bool read_xpm_header ( QIODevice device,
const char *const *  source,
int &  index,
QByteArray state,
int *  cpp,
int *  ncols,
int *  w,
int *  h 
)
static

Definition at line 814 of file qxpmhandler.cpp.

References cpp, device, read_xpm_string(), and state.

Referenced by qt_read_xpm_image_or_array().

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

◆ read_xpm_string()

static bool read_xpm_string ( QByteArray buf,
QIODevice d,
const char *const *  source,
int &  index,
QByteArray state 
)
static

Definition at line 766 of file qxpmhandler.cpp.

References d, forever, and state.

Referenced by read_xpm_body(), and read_xpm_header().

+ Here is the caller graph for this function:

◆ write_xpm_image()

static bool write_xpm_image ( const QImage sourceImage,
QIODevice device,
const QString fileName 
)
static

Definition at line 1071 of file qxpmhandler.cpp.

References QString::asprintf(), QImage::convertToFormat(), cpp, device, Qt::endl(), fbname(), fileName, QImage::format(), QImage::Format_ARGB32, QImage::Format_ARGB32_Premultiplied, QImage::Format_RGB32, it, line, qAlpha(), qBlue(), qCWarning, qGreen(), qRed(), QRgb, and xpm_color_name().

Referenced by QXpmHandler::write().

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

◆ xpm_color_name()

static const char * xpm_color_name ( int  cpp,
int  index,
CharBuffer< 5 > &&  returnable = {} 
)
static

Definition at line 1038 of file qxpmhandler.cpp.

Referenced by write_xpm_image().

+ Here is the caller graph for this function:

◆ xpmHash() [1/2]

static quint64 xpmHash ( char *  str)
static

Definition at line 38 of file qxpmhandler.cpp.

References str.

◆ xpmHash() [2/2]

static quint64 xpmHash ( const QString str)
static

Definition at line 29 of file qxpmhandler.cpp.

References QString::at(), i, QString::size(), str, and QChar::unicode().

Referenced by read_xpm_body().

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

Variable Documentation

◆ xpmRgbTbl

const struct XPMRGBData xpmRgbTbl[]
static

Referenced by qt_get_named_xpm_rgb().

◆ xpmRgbTblSize

const int xpmRgbTblSize = 657
static

Definition at line 54 of file qxpmhandler.cpp.

Referenced by qt_get_named_xpm_rgb().