Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QImage QImage::convertToFormat ( Format  format,
Qt::ImageConversionFlags  flags = Qt::AutoColor 
) const

Returns a copy of the image in the given format.

The specified image conversion flags control how the image data is handled during the conversion process.

See also:
{QImage::Image Format}{Image Format}

Definition at line 3029 of file qimage.cpp.

References convertToFormat(), d, and QImage().

Referenced by convertToFormat(), QGLWidget::convertToGLFormat(), createAlphaMask(), createHeuristicMask(), QPaintEngine::drawImage(), QPixmap::fromImage(), QBitmap::fromImage(), QCommonStyle::generatedIconPixmap(), QCursor::QCursor(), QItemDelegate::selected(), setAlphaChannel(), QPixmap::setMask(), and QCommonStyle::standardPixmap().

{
    if (!d || d->format == format)
        return *this;

    const Image_Converter *converterPtr = &converter_map[d->format - 1][format - 1];
    Image_Converter converter = *converterPtr;
    if (converter) {
        QImage image(d->width, d->height, format);
        converter(image.d, d, flags);
        return image;
    }

#ifdef Q_WS_QWS
#ifdef QT_QWS_DEPTH_16
    if (format == Format_RGB16) {
        QImage tmp;
        if (d->format == Format_RGB32 || d->format == Format_ARGB32)
            tmp = *this;
        else
            tmp = convertToFormat(Format_RGB32, flags);
        QImage image(d->width, d->height, format);
        convert_32_to_16(image.d, tmp.d, flags);
        return image;
    } else if (d->format == Format_RGB16) {
        int targetDepth = depthForFormat(format) == 32;
        QImage image(d->width, d->height, targetDepth == 32 ? format : Format_RGB32);
        convert_16_to_32(image.d, d, flags);
        if (targetDepth == 32)
            return image;
        else
            return image.convertToFormat(format);
    }
#endif
#endif

    return QImage();
}


Generated by  Doxygen 1.6.0   Back to index