The following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code.
enum | Endian { IgnoreEndian, BigEndian, LittleEndian } |
QImage ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) | |
QImage ( const QSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) | |
QImage ( uchar * data, int width, int height, int depth, const QRgb * colortable, int numColors, Endian bitOrder ) | |
QImage ( uchar * data, int width, int height, int depth, int bytesPerLine, const QRgb * colortable, int numColors, Endian bitOrder ) | |
QImage ( const QByteArray & data ) | |
Endian | bitOrder () const |
QImage | convertBitOrder ( Endian bitOrder ) const |
QImage | convertDepth ( int depth, Qt::ImageConversionFlags flags = Qt::AutoColor ) const |
QImage | convertDepthWithPalette ( int depth, QRgb * palette, int palette_count, Qt::ImageConversionFlags flags = Qt::AutoColor ) const |
QImage | copy ( int x, int y, int w, int h, Qt::ImageConversionFlags flags ) const |
QImage | copy ( const QRect & rect, Qt::ImageConversionFlags flags ) const |
bool | create ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) |
bool | create ( const QSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) |
bool | hasAlphaBuffer () const |
void | invertPixels ( bool invertAlpha ) |
uchar ** | jumpTable () |
const uchar * const * | jumpTable () const |
QImage | mirror ( bool horizontal = false, bool vertical = true ) const |
int | numBytes () const |
int | numColors () const |
void | reset () |
QImage | scaleHeight ( int h ) const |
QImage | scaleWidth ( int w ) const |
void | setAlphaBuffer ( bool enable ) |
void | setNumColors ( int numColors ) |
void | setText ( const char * key, const char * language, const QString & text ) |
QImage | smoothScale ( int width, int height, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio ) const |
QImage | smoothScale ( const QSize & size, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio ) const |
QImage | swapRGB () const |
QString | text ( const char * key, const char * language = 0 ) const |
QString | text ( const QImageTextKeyLang & keywordAndLanguage ) const |
QStringList | textLanguages () const |
QList<QImageTextKeyLang> | textList () const |
QImage | xForm ( const QMatrix & matrix ) const |
Endian | systemBitOrder () |
Endian | systemByteOrder () |
void | bitBlt ( QImage * dst, int dx, int dy, const QImage * src, int sx = 0, int sy = 0, int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor ) |
This enum type is used to describe the endianness of the CPU and graphics hardware. It is provided here for compatibility with earlier versions of Qt.
Use the Format enum instead. The Format enum specify the endianess for monchrome formats, but for other formats the endianess is not relevant.
Constant | Value | Description |
---|---|---|
QImage::IgnoreEndian | 2 | Endianness does not matter. Useful for some operations that are independent of endianness. |
QImage::BigEndian | 0 | Most significant bit first or network byte order, as on SPARC, PowerPC, and Motorola CPUs. |
QImage::LittleEndian | 1 | Least significant bit first or little endian byte order, as on Intel x86. |
Constructs an image with the given width, height, depth, numColors colors and bitOrder.
Use the constructor that accepts a width, a height and a format (i.e. specifying the depth and bit order), in combination with the setColorCount() function, instead.
For example, if you have code like
QImage image(width, height, depth, numColors);
you can rewrite it as
QImage image(width, height, format); // For 8 bit images the default number of colors is 256. If // another number of colors is required it can be specified // using the setColorCount() function. image.setColorCount(numColors);
Constructs an image with the given size, depth, numColors and bitOrder.
Use the constructor that accepts a size and a format (i.e. specifying the depth and bit order), in combination with the setColorCount() function, instead.
For example, if you have code like
QSize mySize(width, height); QImage image(mySize, depth, numColors);
you can rewrite it as
QSize mySize(width, height); QImage image(mySize, format); // For 8 bit images the default number of colors is 256. If // another number of colors is required it can be specified // using the setColorCount() function. image.setColorCount(numColors);
Constructs an image with the given width, height, depth, colortable, numColors and bitOrder, that uses an existing memory buffer, data.
Use the constructor that accepts a uchar pointer, a width, a height and a format (i.e. specifying the depth and bit order), in combination with the setColorTable() function, instead.
For example, if you have code like
uchar *myData; QRgb *myColorTable; QImage image(myData, width, height, depth, myColorTable, numColors, IgnoreEndian);
you can rewrite it as
uchar *myData; QVector<QRgb> myColorTable; QImage image(myData, width, height, format); image.setColorTable(myColorTable);
Constructs an image with the given width, height, depth, bytesPerLine, colortable, numColors and bitOrder, that uses an existing memory buffer, data. The image does not delete the buffer at destruction.
Warning: This constructor is only available in Qt for Embedded Linux.
The data has to be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned, so it's no longer possible to specify a custom bytesPerLine value.
Use the static fromData() function instead.
For example, if you have code like
QByteArray data; ... QImage image(data);
you can rewrite it as
QByteArray data; ... QImage image = QImage::fromData(data);
Returns the bit order for the image. If it is a 1-bpp image, this function returns either QImage::BigEndian or QImage::LittleEndian. Otherwise, this function returns QImage::IgnoreEndian.
Use the format() function instead for the monochrome formats. For non-monochrome formats the bit order is irrelevant.
Converts the bit order of the image to the given bitOrder and returns the converted image. The original image is not changed. Returns this image if the given bitOrder is equal to the image current bit order, or a null image if this image cannot be converted.
Use convertToFormat() instead.
Converts the depth (bpp) of the image to the given depth and returns the converted image. The original image is not changed. Returns this image if depth is equal to the image depth, or a null image if this image cannot be converted. The depth argument must be 1, 8 or 32. If the image needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to specify how you'd prefer this to happen.
Use the convertToFormat() function instead.
Returns an image with the given depth, using the palette_count colors pointed to by palette. If depth is 1 or 8, the returned image will have its color table ordered in the same way as palette.
If the image needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to specify how you'd prefer this to happen.
Note: currently no closest-color search is made. If colors are found that are not in the palette, the palette may not be used at all. This result should not be considered valid because it may change in future implementations.
Currently inefficient for non-32-bit images.
Use the convertToFormat() function in combination with the setColorTable() function instead.
Use copy() instead.
Use copy() instead.
Sets the image width, height, depth, its number of colors (in numColors), and bit order. Returns true if successful, or false if the parameters are incorrect or if memory cannot be allocated.
The width and height is limited to 32767. depth must be 1, 8, or 32. If depth is 1, bitOrder must be set to either QImage::LittleEndian or QImage::BigEndian. For other depths bitOrder must be QImage::IgnoreEndian.
This function allocates a color table and a buffer for the image data. The image data is not initialized. The image buffer is allocated as a single block that consists of a table of scanLine() pointers (jumpTable()) and the image data (bits()).
Use a QImage constructor instead.
This is an overloaded function.
The width and height are specified in the size argument.
Use a QImage constructor instead.
Returns true if alpha buffer mode is enabled; otherwise returns false.
Use the hasAlphaChannel() function instead.
Use the invertPixels() function that takes a QImage::InvertMode parameter instead.
Returns a pointer to the scanline pointer table. This is the beginning of the data block for the image. Returns 0 in case of an error.
Use the bits() or scanLine() function instead.
This is an overloaded function.
Use mirrored() instead.
Returns the number of bytes occupied by the image data.
See also byteCount().
Returns the size of the color table for the image.
See also setNumColors() and setColorCount().
Resets all image parameters and deallocates the image data.
Assign a null image instead.
For example, if you have code like
QImage image; image.reset();
you can rewrite it as
QImage image; image = QImage();
Use scaledToHeight() instead.
Use scaledToWidth() instead.
Enables alpha buffer mode if enable is true, otherwise disables it. The alpha buffer is used to set a mask when a QImage is translated to a QPixmap.
If a monochrome or indexed 8-bit image has alpha channels in their color tables they will automatically detect that they have an alpha channel, so this function is not required. To force alpha channels on 32-bit images, use the convertToFormat() function.
See also hasAlphaBuffer().
Resizes the color table to contain numColors entries.
See also numColors() and setColorCount().
Sets the image text to the given text and associate it with the given key. The text is recorded in the specified language, or in a default language if language is 0.
Use setText() instead.
The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.
Use scaled() instead.
For example, if you have code like
QImage image; image.smoothScale(width, height, mode);
you can rewrite it as
QImage image; image.scaled(width, height, mode, Qt::SmoothTransformation);
This is an overloaded function.
Use scaled() instead.
For example, if you have code like
QImage image; image.smoothScale(size, mode);
you can rewrite it as
QImage image; image.scaled(size, mode, Qt::SmoothTransformation);
Use rgbSwapped() instead.
Determines the bit order of the display hardware. Returns QImage::LittleEndian (LSB first) or QImage::BigEndian (MSB first).
This function is no longer relevant for QImage. Use QSysInfo instead.
Determines the host computer byte order. Returns QImage::LittleEndian (LSB first) or QImage::BigEndian (MSB first).
This function is no longer relevant for QImage. Use QSysInfo instead.
Returns the text recorded for the given key in the given language, or in a default language if language is 0.
Use text() instead.
The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.
This is an overloaded function.
Returns the text recorded for the given keywordAndLanguage.
Use text() instead.
The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.
Returns the language identifiers for which some texts are recorded. Note that if you want to iterate over the list, you should iterate over a copy.
The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.
Returns a list of QImageTextKeyLang objects that enumerate all the texts key/language pairs set for this image.
Use textKeys() instead.
The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.
Use transformed() instead.
For example, if you have code like
QImage image; ... image.xForm(matrix);
you can rewrite it as
QImage image; ... image.transformed(matrix);
Copies a block of pixels from src to dst. The pixels copied from source (src) are converted according to flags if it is incompatible with the destination (dst).
sx, sy is the top-left pixel in src, dx, dy is the top-left position in dst and sw, sh is the size of the copied block. The copying is clipped if areas outside src or dst are specified. If sw is -1, it is adjusted to src->width(). Similarly, if sh is -1, it is adjusted to src->height().
Currently inefficient for non 32-bit images.
Use copy() or QPainter::drawImage() instead.