Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride). The buffer must remain valid throughout the life of the QImage. The image does not delete the buffer at destruction. If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setNumColors() or setColorTable() before the image is used. Unlike the similar QImage constructor that takes a non-const data buffer, this version will never alter the contents of the buffer. For example, calling QImage::bits() will return a deep copy of the image, rather than the buffer passed to the constructor. This allows for the efficiency of constructing a QImage from raw data, without the possibility of the raw data being changed. Definition at line 946 of file qimage.cpp. :QPaintDevice()
{
d = QImageData::create(const_cast<uchar*>(data), width, height, bytesPerLine, format, true);
}
|