Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |
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.
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 setNumColors() 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 setNumColors() function. image.setNumColors(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 setNumColors() 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 setNumColors() function. image.setNumColors(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 Qtopia Core.
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.
This is an overloaded member function, provided for convenience.
Use copy() instead.
This is an overloaded member function, provided for convenience.
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 member function, provided for convenience.
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.
This is an overloaded member function, provided for convenience.
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.
Use the bits() or scanLine() function instead.
This is an overloaded member function, provided for convenience.
Use mirrored() instead.
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().
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 member function, provided for convenience.
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.
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.
Copyright © 2008 Trolltech | Trademarks | Qt 4.3.5 |