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

void QImage::setNumColors ( int  numColors  ) 

Resizes the color table to contain numColors entries.

If the color table is expanded, all the extra colors will be set to transparent (i.e qRgba(0, 0, 0, 0)).

See also:
numColors(), colorTable(), {QImage::Image Transformations}{Image Transformations}

Definition at line 1913 of file qimage.cpp.

References detach().

Referenced by alphaChannel(), createHeuristicMask(), and QGLWidget::grabFrameBuffer().

{
    if (!d) {
        qWarning("QImage::setNumColors: null image");
        return;
    }

    detach();
    if (numColors == d->colortable.size())
        return;
    if (numColors <= 0) {                        // use no color table
        d->colortable = QVector<QRgb>();
        return;
    }
    int nc = d->colortable.size();
    d->colortable.resize(numColors);
    for (int i = nc; i < numColors; ++i)
        d->colortable[i] = 0;
}


Generated by  Doxygen 1.6.0   Back to index