QImage::loadFromData
-
Hi,
As an example take a web server that streams jpg images, you can build a QImage from the data received (once you have all the data that is)
-
@SGaist sorry? but i am not quite sure i know what u mean...
i just doubt that i send a wrong len as the param.... but i dont know what is the right value that should be set, as for a DDS file with Mipmap, considering the Pitch..... -
Len should be number of byte of your image. Using this function, Qt will try to guess the format unless you give it him and use the proper reader if it has one for that format
-
but when i tried to load a DDS file which is BC5 with mipmap, always failed....
so i wonder if i set the wrong len, considering the Pitch...
how to set the len if there is a Pitch? -
What error message do you get ?
-
just return false....and so i donot know what error it was...
-
Did you check that you have the dds plugin ?
-
i donot use dds plugin...i use my own way to open the image file and copy the memory to the QImage through QImage::loadFromData
-
loadFromData expects an Image of a known format, or you should provide your own plugin to read the data. If you want to use raw bytes then you should use one of the QImage constructors dedicated to that.
-
the format i do know, is DDS...but it's DDS BC5...and the plugin can't show it...that's why i have to copy the memory to the QImage by myself...
how can i use one of the QImage constructors dedicated to that ??
i am not quite sure about this....is there example? -
As silly as it may sound, just provide the data the specific constructor needs to have
-
`
QImage(uchar * data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = 0, void * cleanupInfo = 0)QImage(const uchar * data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = 0, void * cleanupInfo = 0)
QImage(uchar * data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = 0, void * cleanupInfo = 0)
QImage(const uchar * data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = 0, void * cleanupInfo = 0)
QImage(const char * const[] xpm)
` -
use these two?
QImage(uchar * data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = 0, void * cleanupInfo = 0)QImage(const uchar * data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = 0, void * cleanupInfo = 0)