45 #include <QtGui/qtransform.h> 46 #include <QtGui/qpaintdevice.h> 47 #include <QtGui/qrgb.h> 48 #include <QtCore/qbytearray.h> 49 #include <QtCore/qrect.h> 50 #include <QtCore/qstring.h> 63 template <
class T>
class QList;
64 template <
class T>
class QVector;
68 #ifndef QT_NO_IMAGE_TEXT 78 {
return key < other.
key || (key==other.
key && lang < other.
lang); }
80 {
return key==other.
key && lang==other.
lang; }
84 #endif //QT_NO_IMAGE_TEXT 114 Format_Grayscale4LSB,
131 #ifndef QT_NO_IMAGEFORMAT_XPM 132 explicit QImage(
const char *
const xpm[]);
135 #ifndef QT_NO_CAST_FROM_ASCII 143 #ifdef Q_COMPILER_RVALUE_REFS 145 {
qSwap(
d, other.d);
return *
this; }
157 bool isDetached()
const;
161 {
return copy(
QRect(x, y, w, h)); }
178 int bitPlaneCount()
const;
180 QRgb color(
int i)
const;
181 void setColor(
int i,
QRgb c);
185 void setColorCount(
int);
187 bool allGray()
const;
188 bool isGrayscale()
const;
191 const uchar *bits()
const;
192 const uchar *constBits()
const;
196 int byteCount()
const;
198 uchar *scanLine(
int);
199 const uchar *scanLine(
int)
const;
200 const uchar *constScanLine(
int)
const;
201 int bytesPerLine()
const;
203 bool valid(
int x,
int y)
const;
204 bool valid(
const QPoint &pt)
const;
206 int pixelIndex(
int x,
int y)
const;
207 int pixelIndex(
const QPoint &pt)
const;
209 QRgb pixel(
int x,
int y)
const;
212 void setPixel(
int x,
int y,
uint index_or_rgb);
213 void setPixel(
const QPoint &pt,
uint index_or_rgb);
218 void fill(
uint pixel);
219 void fill(
const QColor &color);
223 bool hasAlphaChannel()
const;
224 void setAlphaChannel(
const QImage &alphaChannel);
225 QImage alphaChannel()
const;
227 #ifndef QT_NO_IMAGE_HEURISTIC_MASK 228 QImage createHeuristicMask(
bool clipTight =
true)
const;
234 {
return scaled(
QSize(w, h), aspectMode, mode); }
243 QImage mirrored(
bool horizontally =
false,
bool vertically =
true)
const;
244 QImage rgbSwapped()
const;
250 bool loadFromData(
const uchar *buf,
int len,
const char *format = 0);
252 {
return loadFromData(reinterpret_cast<const uchar *>(data.
constData()), data.
size(), aformat); }
254 bool save(
const QString &fileName,
const char* format=0,
int quality=-1)
const;
255 bool save(
QIODevice *device,
const char* format=0,
int quality=-1)
const;
257 static QImage fromData(
const uchar *
data,
int size,
const char *format = 0);
259 {
return fromData(reinterpret_cast<const uchar *>(data.
constData()), data.
size(),
format); }
261 int serialNumber()
const;
267 int dotsPerMeterX()
const;
268 int dotsPerMeterY()
const;
269 void setDotsPerMeterX(
int);
270 void setDotsPerMeterY(
int);
272 void setOffset(
const QPoint&);
273 #ifndef QT_NO_IMAGE_TEXT 288 enum Endian { BigEndian, LittleEndian, IgnoreEndian };
289 QT3_SUPPORT_CONSTRUCTOR
QImage(
int width,
int height,
int depth,
int numColors=0,
Endian bitOrder=IgnoreEndian);
290 QT3_SUPPORT_CONSTRUCTOR QImage(
const QSize&,
int depth,
int numColors=0,
Endian bitOrder=IgnoreEndian);
291 QT3_SUPPORT_CONSTRUCTOR QImage(
uchar *data,
int w,
int h,
int depth,
const QRgb *colortable,
int numColors,
Endian bitOrder);
293 QT3_SUPPORT_CONSTRUCTOR QImage(
uchar *data,
int w,
int h,
int depth,
int pbl,
const QRgb *colortable,
int numColors,
Endian bitOrder);
295 inline QT3_SUPPORT
Endian bitOrder()
const {
297 return f == Format_Mono ? BigEndian : (f == Format_MonoLSB ? LittleEndian : IgnoreEndian);
299 QT3_SUPPORT QImage convertDepth(
int, Qt::ImageConversionFlags flags =
Qt::AutoColor)
const;
300 QT3_SUPPORT QImage convertDepthWithPalette(
int,
QRgb* p,
int pc, Qt::ImageConversionFlags flags =
Qt::AutoColor)
const;
301 QT3_SUPPORT QImage convertBitOrder(
Endian)
const;
302 QT3_SUPPORT
bool hasAlphaBuffer()
const;
303 QT3_SUPPORT
void setAlphaBuffer(
bool);
304 QT3_SUPPORT
uchar **jumpTable();
305 QT3_SUPPORT
const uchar *
const *jumpTable()
const;
306 inline QT3_SUPPORT
void reset() { *
this = QImage(); }
307 static inline QT3_SUPPORT
Endian systemByteOrder()
308 {
return QSysInfo::ByteOrder == QSysInfo::BigEndian ? BigEndian : LittleEndian; }
309 inline QT3_SUPPORT QImage swapRGB()
const {
return rgbSwapped(); }
310 inline QT3_SUPPORT QImage mirror(
bool horizontally =
false,
bool vertically =
true)
const 311 {
return mirrored(horizontally, vertically); }
312 QT3_SUPPORT
bool create(
const QSize&,
int depth,
int numColors=0,
Endian bitOrder=IgnoreEndian);
313 QT3_SUPPORT
bool create(
int width,
int height,
int depth,
int numColors=0,
Endian bitOrder=IgnoreEndian);
314 inline QT3_SUPPORT QImage xForm(
const QMatrix &matrix)
const {
return transformed(
QTransform(matrix)); }
319 inline QT3_SUPPORT QImage scaleWidth(
int w)
const {
return scaledToWidth(w); }
320 inline QT3_SUPPORT QImage scaleHeight(
int h)
const {
return scaledToHeight(h); }
321 inline QT3_SUPPORT
void invertPixels(
bool invertAlpha) { invertAlpha ? invertPixels(InvertRgba) : invertPixels(InvertRgb); }
322 inline QT3_SUPPORT QImage copy(
int x,
int y,
int w,
int h, Qt::ImageConversionFlags)
const 323 {
return copy(
QRect(x, y, w, h)); }
324 inline QT3_SUPPORT QImage copy(
const QRect &rect, Qt::ImageConversionFlags)
const 325 {
return copy(rect); }
326 static QT3_SUPPORT
Endian systemBitOrder();
327 inline QT3_SUPPORT_CONSTRUCTOR QImage(
const QByteArray &data)
361 #if !defined(QT_NO_DATASTREAM) 368 int sx=0,
int sy=0,
int sw=-1,
int sh=-1, Qt::ImageConversionFlags flags =
Qt::AutoColor);
The QVariant class acts like a union for the most common Qt data types.
The QColor class provides colors based on RGB, HSV or CMYK values.
Format
The following image formats are available in Qt.
Q_GUI_EXPORT QDataStream & operator<<(QDataStream &, const QImage &)
#define QT_END_NAMESPACE
This macro expands to.
The QMatrix class specifies 2D transformations of a coordinate system.
QImage copy(int x, int y, int w, int h) const
The returned image is copied from the position (x, y) in this image, and will always have the given w...
The QByteArray class provides an array of bytes.
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
QImageTextKeyLang(const char *k, const char *l)
InvertMode
This enum type is used to describe how pixel values should be inverted in the invertPixels() function...
Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QImage &)
bool operator!=(QBool b1, bool b2)
The QString class provides a Unicode character string.
The QVector class is a template class that provides a dynamic array.
QRgb pixel(int x, int y) const
Returns the color of the pixel at coordinates (x, y).
bool operator<(int priority, const QPair< QRunnable *, int > &p)
virtual int devType() const
int pixelIndex(int x, int y) const
Returns the pixel index at (x, y).
#define Q_DECLARE_SHARED(TYPE)
#define QT_BEGIN_NAMESPACE
This macro expands to.
void swap(QImage &other)
Swaps image other with this image.
The QStringList class provides a list of strings.
The QImage class provides a hardware-independent image representation that allows direct access to th...
static const char * data(const QByteArray &arr)
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
void qSwap(T &value1, T &value2)
QT_DEPRECATED int numColors() const
bool valid(int x, int y) const
Returns true if QPoint(x, y) is a valid coordinate pair within the image; otherwise returns false...
const char * constData() const
Returns a pointer to the data stored in the byte array.
#define Q_REQUIRED_RESULT
void setPixel(int x, int y, uint index_or_rgb)
Sets the pixel index or color at (x, y) to index_or_rgb.
virtual QPaintEngine * paintEngine() const =0
Q_GUI_EXPORT qint64 qt_image_id(const QImage &image)
The QPoint class defines a point in the plane using integer precision.
The QRect class defines a rectangle in the plane using integer precision.
int size() const
Returns the number of bytes in this byte array.
virtual int metric(PaintDeviceMetric metric) const
int y() const
Returns the y coordinate of this point.
#define Q_GUI_EXPORT_INLINE
static QImage fromData(const QByteArray &data, const char *format=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const QVector< QRgb > * qt_image_colortable(const QImage &image)
The QSize class defines the size of a two-dimensional object using integer point precision.
The QDataStream class provides serialization of binary data to a QIODevice.
Q_DECLARE_TYPEINFO(QImage, Q_MOVABLE_TYPE)
int x() const
Returns the x coordinate of this point.
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
The QIODevice class is the base interface class of all I/O devices in Qt.
bool loadFromData(const QByteArray &data, const char *aformat=0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString fileName(const QString &fileUrl)
bool operator==(QBool b1, bool b2)
static QImage fromData(const uchar *data, int size, const char *format=0)
Constructs a QImage from the first size bytes of the given binary data.
static bool isNull(const QVariant::Private *d)
The QList class is a template class that provides lists.