44 #include <QtCore/QIODevice> 45 #include <QtCore/QDebug> 46 #include <QtCore/QDateTime> 61 quint16 d = (int(ch1) & 0xFF) | ((
int(ch2) & 0xFF) << 8);
62 QRgb result = (d & 0x8000) ? 0xFF000000 : 0x00000000;
63 result |= (d & 0x7C00 << 6) | (d & 0x03E0 << 3) | (d & 0x001F);
164 bool validDepth = (bitsPerPixel == 16 || bitsPerPixel == 24 || bitsPerPixel == 32);
234 for (
int i = 0; i < offset; ++i)
238 int imageWidth =
width();
239 int imageHeight =
height();
243 unsigned char yCorner = desc & 0x20;
247 if (bitsPerPixel == 16)
249 else if (bitsPerPixel == 24)
251 else if (bitsPerPixel == 32)
259 for (
int y = 0; y < imageHeight; ++y)
260 for (
int x = 0; x < imageWidth; ++x)
265 for (
int y = imageHeight - 1; y >= 0; --y)
266 for (
int x = 0; x < imageWidth; ++x)
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
QRgb operator()(QIODevice *s) const
bool isReadable() const
Returns true if data can be read from the device; otherwise returns false.
virtual QRgb operator()(QIODevice *s) const =0
bool getChar(char *c)
Reads one character from the device and stores it in c.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QTgaFile(QIODevice *)
Construct a new QTgaFile object getting data from device.
long ASN1_INTEGER_get ASN1_INTEGER * a
QImage readImage()
Reads an image file from the QTgaFile's device, and returns it.
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
QRgb operator()(QIODevice *s) const
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
The QImage class provides a hardware-independent image representation that allows direct access to th...
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
void setPixel(int x, int y, uint index_or_rgb)
Sets the pixel index or color at (x, y) to index_or_rgb.
unsigned char mHeader[HeaderSize]
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)
int qstrncmp(const char *str1, const char *str2, uint len)
QRgb operator()(QIODevice *s) const
static quint16 littleEndianInt(const unsigned char *d)
Returns the integer encoded in the two little endian bytes at d.
~QTgaFile()
Destroy the device, recovering any resources.
The QIODevice class is the base interface class of all I/O devices in Qt.
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success...