Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# Compatibility Members for QImage

The following class members are part of the Qt 3 compatibility layer. They are provided to help you port old code to Qt 4. We strongly advise against using them in new code.

QImage class reference

### Public Functions

- QImage ( const char * const[] xpm )
- QImage smoothScale ( int w, int h, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio ) const
- QImage smoothScale ( const QSize & s, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio ) const
- QImage xForm ( const QMatrix & matrix ) const

## Member Function Documentation

### QImage::QImage ( const char * const[] xpm )

Constructs an image from xpm, which must be a valid XPM image.

Errors are silently ignored.

Note that it's possible to squeeze the XPM variable a little bit by using an unusual declaration:

        static const char * const start_xpm[]={
            "16 15 8 1",
            "a c #cec6bd",
        ....

The extra `const` makes the entire definition read-only, which is slightly more efficient (e.g. when the code is in a shared library) and ROMable when the application is to be stored in ROM.

### QImage QImage::smoothScale ( int w, int h, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio ) const

Returns a smoothly scaled copy of the image. The returned image has a size of width w by height h pixels if mode is `Qt::IgnoreAspectRatio`. The modes `Qt::KeepAspectRatio` and `Qt::KeepAspectRatioByExpanding` may be used to preserve the ratio of the image: if mode is `Qt::KeepAspectRatio`, the returned image is guaranteed to fit into the rectangle specified by w and h (it is as large as possible within the constraints); if mode is `Qt::KeepAspectRatioByExpanding`, the returned image fits at least into the specified rectangle (it is a small as possible within the constraints). Note that the algorithm used favors speed rather than smoothness.

For 32-bpp images and 1-bpp/8-bpp color images the result will be 32-bpp, whereas all-gray images (including black-and-white 1-bpp) will produce 8-bit grayscale images with the palette spanning 256 grays from black to white.

See also scale() and mirror().

### QImage QImage::smoothScale ( const QSize & s, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio ) const

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

The requested size of the image is s.

### QImage QImage::xForm ( const QMatrix & matrix ) const

Transforms the image using the given matrix and returns the result as a new image.