6#include <QtCore/QIODevice>
7#include <QtCore/QDebug>
8#include <QtCore/QDateTime>
9#include <QtGui/QImageIOHandler>
27 if (
s->getChar(&ch1) &&
s->getChar(&ch2)) {
28 quint16 d = (int(ch1) & 0xFF) | ((
int(ch2) & 0xFF) << 8);
29 QRgb result = (
d & 0x8000) ? 0xFF000000 : 0x00000000;
30 result |= ((
d & 0x7C00) << 6) | ((
d & 0x03E0) << 3) | (
d & 0x001F);
43 if (
s->getChar(&
b) &&
s->getChar(&
g) &&
s->getChar(&
r))
55 if (
s->getChar(&
b) &&
s->getChar(&
g) &&
s->getChar(&
r) &&
s->getChar(&
a))
103 mErrorMessage =
tr(
"Could not read image data");
108 mErrorMessage =
tr(
"Sequential device (eg socket) for image read not supported");
111 if (!mDevice->
seek(0))
113 mErrorMessage =
tr(
"Seek file/device for image read failed");
117 mErrorMessage =
tr(
"Image header read failed");
123 mErrorMessage =
tr(
"Image type not supported");
130 mErrorMessage =
tr(
"Image depth not valid");
135 mErrorMessage =
tr(
"Image size exceeds limit");
138 int curPos = mDevice->
pos();
139 int fileBytes = mDevice->
size();
142 mErrorMessage =
tr(
"Could not seek to image read footer");
147 mErrorMessage =
tr(
"Could not read footer");
151 mErrorMessage =
tr(
"Image type (non-TrueVision 2.0) not supported");
153 if (!mDevice->
seek(curPos))
155 mErrorMessage =
tr(
"Could not reset to read data");
194 if (cmapDepth != 16 && cmapDepth != 24 && cmapDepth != 32) {
195 mErrorMessage =
tr(
"Invalid color map depth (%1)").arg(cmapDepth);
208 int imageWidth =
width();
209 int imageHeight =
height();
213 unsigned char yCorner =
desc & 0x20;
233 for (
int y = 0;
y < imageHeight; ++
y)
234 for (
int x = 0;
x < imageWidth; ++
x)
239 for (
int y = imageHeight - 1;
y >= 0; --
y)
240 for (
int x = 0;
x < imageWidth; ++
x)
IOBluetoothDevice * device
\inmodule QtCore \reentrant
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from.
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
bool isReadable() const
Returns true if data can be read from the device; otherwise returns false.
bool getChar(char *c)
Reads one character from the device and stores it in c.
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success,...
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read.
static bool allocateImage(QSize size, QImage::Format format, QImage *image)
void setPixel(int x, int y, uint index_or_rgb)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QTgaFile(QIODevice *)
Construct a new QTgaFile object getting data from device.
int qstrncmp(const char *str1, const char *str2, size_t len)
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr offset
constexpr QPixelLayout::BPP bitsPerPixel()
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
constexpr QRgb qRgb(int r, int g, int b)
constexpr QRgb qRgba(int r, int g, int b, int a)
unsigned long long quint64
ReturnedValue read(const char *data)
QRgb operator()(QIODevice *s) const override
QRgb operator()(QIODevice *s) const override
QRgb operator()(QIODevice *s) const override
virtual QRgb operator()(QIODevice *s) const =0